diff --git a/py/webnotes/__init__.py b/py/webnotes/__init__.py index 3a075d201b..5e9f7d0b21 100644 --- a/py/webnotes/__init__.py +++ b/py/webnotes/__init__.py @@ -87,12 +87,35 @@ def create_folder(path): try: os.makedirs(path) - except Exception, e: - if e.args[0]==17: - pass - else: + except OSError, e: + if e.args[0]!=17: raise e +def create_symlink(source_path, link_path): + """ + Wrapper function for os.symlink (does not throw exception if directory exists) + """ + import os + + try: + os.symlink(source_path, link_path) + except OSError, e: + if e.args[0]!=17: + raise e + +def remove_file(path): + """ + Wrapper function for os.remove (does not throw exception if file/symlink does not exists) + """ + import os + + try: + os.remove(path) + except OSError, e: + if e.args[0]!=2: + raise e + + def connect(db_name=None): """ Connect to this db (or db), if called from command prompt @@ -128,4 +151,4 @@ def get_db_password(db_name): return defs.db_password else: - return db_name \ No newline at end of file + return db_name diff --git a/py/webnotes/boot.py b/py/webnotes/boot.py index d9a06bd352..c8e8450143 100644 --- a/py/webnotes/boot.py +++ b/py/webnotes/boot.py @@ -16,6 +16,10 @@ def get_bootinfo(): # control panel import webnotes.model.doc cp = webnotes.model.doc.getsingle('Control Panel') + + # remove email settings from control panel dict + for field in ['mail_login', 'mail_password', 'mail_port', 'outgoing_mail_server', 'use_ssl']: + del cp[field] # system info bootinfo['control_panel'] = cp