From 32671fd67b76cbb7f6187f1661bbee35163bce45 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 6 Dec 2011 18:52:42 +0530 Subject: [PATCH] Changes in email lib to send email from defs specifications --- py/core/doctype/print_format/print_format.txt | 8 ++++---- py/webnotes/defs_template.py | 3 +++ py/webnotes/utils/email_lib/__init__.py | 4 ++-- py/webnotes/utils/email_lib/send.py | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/py/core/doctype/print_format/print_format.txt b/py/core/doctype/print_format/print_format.txt index 054e272381..b8ee2ce453 100644 --- a/py/core/doctype/print_format/print_format.txt +++ b/py/core/doctype/print_format/print_format.txt @@ -5,14 +5,14 @@ { 'creation': '2009-05-12 16:43:58', 'docstatus': 0, - 'modified': '2011-11-23 13:39:59', + 'modified': '2011-12-05 11:45:45', 'modified_by': 'Administrator', 'owner': 'Administrator' }, # These values are common for all DocType { - '_last_update': '1321362800', + '_last_update': '1322035799', 'allow_attach': 0, 'allow_copy': 0, 'allow_email': 0, @@ -40,7 +40,7 @@ 'subject': 'eval:("Module: %(module)s, Type: %(doc_type)s, Standard: %(standard)s")', 'tag_fields': 'doc_type', 'use_template': 0, - 'version': 24 + 'version': 25 }, # These values are common for all DocField @@ -99,7 +99,7 @@ 'no_copy': 0, 'oldfieldname': 'module', 'oldfieldtype': 'Select', - 'options': 'Module Def', + 'options': 'link:Module Def', 'print_hide': 0, 'report_hide': 0, 'reqd': 1, diff --git a/py/webnotes/defs_template.py b/py/webnotes/defs_template.py index 823edc0356..1b55c20cbf 100644 --- a/py/webnotes/defs_template.py +++ b/py/webnotes/defs_template.py @@ -116,3 +116,6 @@ backup_link_path = '/var/www/wnframework/backups' # url to be emailed to the "System Manager" Role to download # the backup backup_url = 'http://localhost/backups' + +# System TimeZone (should be acceptable by pytz: Recommended format Continent/City) +system_timezone = 'Asia/Kolkata' diff --git a/py/webnotes/utils/email_lib/__init__.py b/py/webnotes/utils/email_lib/__init__.py index 7d0572d46b..4497055786 100644 --- a/py/webnotes/utils/email_lib/__init__.py +++ b/py/webnotes/utils/email_lib/__init__.py @@ -19,7 +19,7 @@ def make_html_body(content, template = None): return template_html % {'content': content} -def sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc=[], attach=[], send_now=1, reply_to=None, template=None): +def sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc=[], attach=[], send_now=1, reply_to=None, template=None, from_defs=0): """ send an html email as multipart with attachments and all """ @@ -27,7 +27,7 @@ def sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc from webnotes.utils.email_lib.html2text import html2text from webnotes.utils.email_lib.send import EMail - email = EMail(sender, recipients, subject, reply_to=reply_to) + email = EMail(sender, recipients, subject, reply_to=reply_to, from_defs=from_defs) email.cc = cc if msg: diff --git a/py/webnotes/utils/email_lib/send.py b/py/webnotes/utils/email_lib/send.py index 52e4572459..b6c01d04df 100644 --- a/py/webnotes/utils/email_lib/send.py +++ b/py/webnotes/utils/email_lib/send.py @@ -138,6 +138,7 @@ class EMail: setup the SMTP (outgoing) server from `Control Panel` or defs.py """ if self.from_defs: + import webnotes self.server = getattr(webnotes.defs,'mail_server','') self.login = getattr(webnotes.defs,'mail_login','') self.port = getattr(webnotes.defs,'mail_port',None)