@@ -212,6 +212,7 @@ def set_user(username): | |||||
from frappe.utils.user import User | from frappe.utils.user import User | ||||
local.session.user = username | local.session.user = username | ||||
local.session.sid = username | local.session.sid = username | ||||
local.cache = {} | |||||
local.session.data = {} | local.session.data = {} | ||||
local.user = User(username) | local.user = User(username) | ||||
local.restrictions = None | local.restrictions = None | ||||
@@ -66,12 +66,12 @@ def post(arg=None): | |||||
import json | import json | ||||
arg = json.loads(arg) | arg = json.loads(arg) | ||||
d = frappe.new_doc('Comment') | |||||
d = frappe.new_doc('Comment') | |||||
d.parenttype = arg.get("parenttype") | d.parenttype = arg.get("parenttype") | ||||
d.comment = arg['txt'] | d.comment = arg['txt'] | ||||
d.comment_docname = arg['contact'] | d.comment_docname = arg['contact'] | ||||
d.comment_doctype = 'Message' | d.comment_doctype = 'Message' | ||||
d.save() | |||||
d.insert(ignore_permissions=True) | |||||
delete_notification_count_for("Messages") | delete_notification_count_for("Messages") | ||||
@@ -11,6 +11,11 @@ from frappe.model.document import Document | |||||
class EmptyTableError(frappe.ValidationError): pass | class EmptyTableError(frappe.ValidationError): pass | ||||
class DocListController(Document): | class DocListController(Document): | ||||
def __init__(self, arg1, arg2=None): | |||||
super(DocListController, self).__init__(arg1, arg2) | |||||
if hasattr(self, "setup"): | |||||
self.setup() | |||||
def validate_value(self, fieldname, condition, val2, doc=None, raise_exception=None): | def validate_value(self, fieldname, condition, val2, doc=None, raise_exception=None): | ||||
"""check that value of fieldname should be 'condition' val2 | """check that value of fieldname should be 'condition' val2 | ||||
else throw exception""" | else throw exception""" | ||||
@@ -105,7 +105,7 @@ def has_unrestricted_access(doc, verbose=True): | |||||
def has_controller_permissions(doc): | def has_controller_permissions(doc): | ||||
if doc.get("__islocal"): | if doc.get("__islocal"): | ||||
doc = frappe.get_doc([doc]) | |||||
doc = frappe.get_doc(doc) | |||||
else: | else: | ||||
doc = frappe.get_doc(doc.doctype, doc.name) | doc = frappe.get_doc(doc.doctype, doc.name) | ||||
@@ -141,7 +141,7 @@ def make_test_objects(doctype, test_records, verbose=None): | |||||
records = [] | records = [] | ||||
for doc in test_records: | for doc in test_records: | ||||
if not hasattr(doc, "doctype"): | |||||
if not doc.get("doctype"): | |||||
doc["doctype"] = doctype | doc["doctype"] = doctype | ||||
d = frappe.copy_doc(doc) | d = frappe.copy_doc(doc) | ||||