From 2e5afbcd7a7fe830434bdb300b1d7cdd171e40de Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 28 Nov 2012 10:47:50 +0530 Subject: [PATCH] support ticket: updated signature, doctype: create py if not exists --- core/doctype/doctype/doctype.py | 12 ++++++++++++ webnotes/profile.py | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py index db349a671b..3420f71aef 100644 --- a/core/doctype/doctype/doctype.py +++ b/core/doctype/doctype/doctype.py @@ -103,6 +103,18 @@ class DocType: def import_doc(self): from webnotes.modules.import_module import import_from_files import_from_files(record_list=[[self.doc.module, 'doctype', self.doc.name]]) + + def make_controller_template(self): + from webnotes.modules import get_doc_path, get_module_path, scrub + + pypath = os.path.join(get_doc_path(self.doc.module, + self.doc.doctype, self.doc.name), scrub(self.doc.name) + '.py') + + if not os.path.exists(pypath): + with open(pypath, 'w') as pyfile: + with open(os.path.join(get_module_path("core"), "doctype", "doctype", + "doctype_template.py"), 'r') as srcfile: + pyfile.write(srcfile.read()) def make_file_list(self): """ diff --git a/webnotes/profile.py b/webnotes/profile.py index 3fce72e2da..cd97e695b7 100644 --- a/webnotes/profile.py +++ b/webnotes/profile.py @@ -206,17 +206,18 @@ class Profile: Return a dictionary of user properites to be stored in the session """ t = webnotes.conn.sql("""select email, first_name, last_name, - recent_documents from tabProfile where name = %s""", self.name)[0] + recent_documents, email_signature from tabProfile where name = %s""", self.name)[0] if not self.can_read: self.build_permissions() - d = {} + d = webnotes.DictObj({}) d['name'] = self.name d['email'] = t[0] or '' d['first_name'] = t[1] or '' d['last_name'] = t[2] or '' d['recent'] = t[3] or '' + d.email_signature = t[4] d['hide_tips'] = self.get_hide_tips()