[cleanups]

This commit is contained in:
Rushabh Mehta 2016-07-08 18:21:33 +05:30
parent 56857c4b7f
commit 3e3e30cfa6
10 changed files with 34 additions and 18 deletions

View file

@ -460,12 +460,13 @@ def clear_cache(user=None, doctype=None):
frappe.sessions.clear_cache()
translate.clear_cache()
reset_metadata_version()
frappe.local.cache = {}
local.cache = {}
local.new_doc_templates = {}
for fn in frappe.get_hooks("clear_cache"):
for fn in get_hooks("clear_cache"):
get_attr(fn)()
frappe.local.role_permissions = {}
local.role_permissions = {}
def has_permission(doctype=None, ptype="read", doc=None, user=None, verbose=False, throw=False):
"""Raises `frappe.PermissionError` if not permitted.

View file

@ -1,6 +1,6 @@
from __future__ import unicode_literals, absolute_import
import click
import hashlib, os
import hashlib, os, sys
import frappe
from frappe.commands import pass_context, get_site
from frappe.commands.scheduler import _is_scheduler_enabled
@ -83,6 +83,13 @@ def restore(context, sql_file_path, mariadb_root_username=None, mariadb_root_pas
"Restore site database from an sql file"
from frappe.installer import extract_sql_gzip, extract_tar_files
# Extract the gzip file if user has passed *.sql.gz file instead of *.sql file
if not os.path.exists(sql_file_path):
sql_file_path = '../' + sql_file_path
if not os.path.exists(sql_file_path):
print 'Invalid path {0}' + sql_file_path[3:]
sys.exit(1)
if sql_file_path.endswith('sql.gz'):
sql_file_path = extract_sql_gzip(os.path.abspath(sql_file_path))

View file

@ -319,6 +319,11 @@ a.form-link {
textarea.form-control {
height: 120px;
}
.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
background-color: #fafbfc;
}
.link-select-row {
padding: 5px;
border-bottom: 1px solid #EBEFF2;

View file

@ -108,11 +108,6 @@
.grid-body .editable-row .has-error .form-control:focus {
border-color: #ff5858;
}
.grid-body .editable-row .form-control[disabled],
.grid-body .editable-row .form-control[readonly],
.grid-body .editable-row fieldset[disabled] .form-control {
background-color: #fafbfc;
}
.grid-body .editable-row input[data-fieldtype="Int"],
.grid-body .editable-row input[data-fieldtype="Float"],
.grid-body .editable-row input[data-fieldtype="Currency"] {

View file

@ -93,7 +93,10 @@ frappe.msgprint = function(msg, title) {
}
if(data.message instanceof Array) {
data.message = $.map(data.message, function(m) { return '<p>' + m + '</p>'}).join('');
data.message.forEach(function(m) {
frappe.msgprint(m);
});
return;
}
if(data.alert) {

View file

@ -365,7 +365,7 @@ _f.Frm.prototype.show_web_link = function() {
if(!doc.__islocal && doc.__onload && doc.__onload.is_website_generator) {
me.web_link && me.web_link.remove();
if(doc.__onload.published) {
me.add_web_link("/" + doc.__onload.website_route)
me.add_web_link("/" + doc.route)
}
}
}

View file

@ -121,6 +121,11 @@ textarea.form-control {
height: 120px;
}
.form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
background-color: @light-bg;
}
.link-select-row {
padding: 5px;
border-bottom: 1px solid @light-border-color;

View file

@ -134,10 +134,6 @@
}
}
.form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control {
background-color: @light-bg;
}
input[data-fieldtype="Int"], input[data-fieldtype="Float"], input[data-fieldtype="Currency"] {
text-align: right;
}

View file

@ -176,7 +176,10 @@ def get_time(time_str):
return time_str.time()
elif isinstance(time_str, datetime.time):
return time_str
return parser.parse(time_str).time()
else:
if isinstance(time_str, datetime.timedelta):
time_str = str(time_str)
return parser.parse(time_str).time()
def get_datetime_str(datetime_obj):
if isinstance(datetime_obj, basestring):

View file

@ -9,6 +9,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -158,7 +159,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
"unique": 1
},
{
"allow_on_submit": 0,
@ -617,7 +618,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 20,
"modified": "2016-06-23 12:29:31.442059",
"modified": "2016-07-08 06:22:38.925289",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Page",