From 05b60627832cc902e02874e086caf299947ebb51 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 31 Aug 2011 14:41:03 +0530 Subject: [PATCH 1/6] admin_email_notification and global_sent_email global variable added in defs_template --- cgi-bin/webnotes/defs_template.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cgi-bin/webnotes/defs_template.py b/cgi-bin/webnotes/defs_template.py index 80e3113129..c312dcbc95 100644 --- a/cgi-bin/webnotes/defs_template.py +++ b/cgi-bin/webnotes/defs_template.py @@ -48,8 +48,26 @@ modules_path = '' # saved to the modules folder # developer_mode = 0 + +# +# Auto Clear Cache: If set, automatically clears cache on refresh +# + auto_cache_clear = 0 +# +# Admin Email Notification: If the admin_email_notification is set, +# then only sent notification email from the system +# + +admin_email_notification = 0 + +# +# Global Sent Email: Global email settings, if 1 then only mail will go from the system +# + +global_sent_email = 1 + # # Time Zone: Useful if your users are across timezones # From ae2ce62be30af6c3bcee223b5892dc4276c1dbae Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 31 Aug 2011 14:48:00 +0530 Subject: [PATCH 2/6] sent patch error notification only if admin_email_notification is on --- cgi-bin/webnotes/modules/patch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cgi-bin/webnotes/modules/patch.py b/cgi-bin/webnotes/modules/patch.py index 5ecd84446c..0b6810f62b 100644 --- a/cgi-bin/webnotes/modules/patch.py +++ b/cgi-bin/webnotes/modules/patch.py @@ -34,4 +34,5 @@ def write_log(): from webnotes.utils import sendmail subj = 'Error in running patches in %s' % webnotes.conn.cur_db_name msg = subj + '

Login User: ' + webnotes.user.name + '

' + webnotes.getTraceback() - sendmail(['developer@erpnext.com'], sender='automail@erpnext.com', subject= subj, parts=[['text/plain', msg]]) + if getattr(webnotes.defs,'admin_email_notification',1): + sendmail(['developers@erpnext.com'], sender='automail@erpnext.com', subject= subj, parts=[['text/plain', msg]]) From ea0d744b2b7c71cdbce5b95469c8f54bdb8bf92f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 31 Aug 2011 17:25:03 +0530 Subject: [PATCH 3/6] ignore if error comes in eval while mapping --- cgi-bin/core/doctype/doctype_mapper/doctype_mapper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cgi-bin/core/doctype/doctype_mapper/doctype_mapper.py b/cgi-bin/core/doctype/doctype_mapper/doctype_mapper.py index 89cf74efae..05b136de11 100644 --- a/cgi-bin/core/doctype/doctype_mapper/doctype_mapper.py +++ b/cgi-bin/core/doctype/doctype_mapper/doctype_mapper.py @@ -143,7 +143,12 @@ class DocType: for f in fld_list: if f[2] == 'Yes': if f[0].startswith('eval:'): - to_doc.fields[f[1]] = eval(f[0][5:]) + try: + val = eval(f[0][5:]) + except: + val = '' + + to_doc.fields[f[1]] = val else: to_doc.fields[f[1]] = obj.fields.get(f[0]) From 2195814d409c5c0925008ca20a95e1f16c974078 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 31 Aug 2011 17:36:47 +0530 Subject: [PATCH 4/6] changed global_sent_email to global_send_email in defs template --- cgi-bin/webnotes/defs_template.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cgi-bin/webnotes/defs_template.py b/cgi-bin/webnotes/defs_template.py index c312dcbc95..7cc5d9bf6d 100644 --- a/cgi-bin/webnotes/defs_template.py +++ b/cgi-bin/webnotes/defs_template.py @@ -60,13 +60,13 @@ auto_cache_clear = 0 # then only sent notification email from the system # -admin_email_notification = 0 +admin_email_notification = 1 # -# Global Sent Email: Global email settings, if 1 then only mail will go from the system +# Global Send Email: Global email settings, if 1 then only mail will go from the system # -global_sent_email = 1 +global_send_email = 1 # # Time Zone: Useful if your users are across timezones From 0eee36f2aee368508dd984d6acd81777f1b6d295 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 5 Sep 2011 11:15:09 +0530 Subject: [PATCH 5/6] admin_email_notification = 0 by default --- cgi-bin/webnotes/defs_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgi-bin/webnotes/defs_template.py b/cgi-bin/webnotes/defs_template.py index 7cc5d9bf6d..823edc0356 100644 --- a/cgi-bin/webnotes/defs_template.py +++ b/cgi-bin/webnotes/defs_template.py @@ -60,7 +60,7 @@ auto_cache_clear = 0 # then only sent notification email from the system # -admin_email_notification = 1 +admin_email_notification = 0 # # Global Send Email: Global email settings, if 1 then only mail will go from the system From c1c19ed7c7fbdd4a2b167129cd62509a4e6e0d37 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 5 Sep 2011 11:18:26 +0530 Subject: [PATCH 6/6] admin_email_notification = 0 by default --- cgi-bin/webnotes/modules/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgi-bin/webnotes/modules/patch.py b/cgi-bin/webnotes/modules/patch.py index 0b6810f62b..816d760371 100644 --- a/cgi-bin/webnotes/modules/patch.py +++ b/cgi-bin/webnotes/modules/patch.py @@ -34,5 +34,5 @@ def write_log(): from webnotes.utils import sendmail subj = 'Error in running patches in %s' % webnotes.conn.cur_db_name msg = subj + '

Login User: ' + webnotes.user.name + '

' + webnotes.getTraceback() - if getattr(webnotes.defs,'admin_email_notification',1): + if getattr(webnotes.defs,'admin_email_notification',0): sendmail(['developers@erpnext.com'], sender='automail@erpnext.com', subject= subj, parts=[['text/plain', msg]])