diff --git a/core/doctype/doctype/doctype.py b/core/doctype/doctype/doctype.py index e92cb05e90..1e744850f6 100644 --- a/core/doctype/doctype/doctype.py +++ b/core/doctype/doctype/doctype.py @@ -311,4 +311,4 @@ def make_module_and_roles(doclist, perm_doctype="DocPerm"): if e.args[0]==1146: pass else: - raise e + raise diff --git a/webnotes/__init__.py b/webnotes/__init__.py index 52d4f464d4..1a7c0e66b7 100644 --- a/webnotes/__init__.py +++ b/webnotes/__init__.py @@ -177,7 +177,7 @@ def create_folder(path): os.makedirs(path) except OSError, e: if e.args[0]!=17: - raise e + raise def create_symlink(source_path, link_path): import os @@ -185,7 +185,7 @@ def create_symlink(source_path, link_path): os.symlink(source_path, link_path) except OSError, e: if e.args[0]!=17: - raise e + raise def remove_file(path): import os @@ -193,7 +193,7 @@ def remove_file(path): os.remove(path) except OSError, e: if e.args[0]!=2: - raise e + raise def connect(db_name=None, password=None, site=None): import webnotes.db diff --git a/webnotes/db.py b/webnotes/db.py index 2034bcbf07..60a581e81a 100644 --- a/webnotes/db.py +++ b/webnotes/db.py @@ -111,7 +111,7 @@ class Database: if ignore_ddl and e.args[0] in (1146,1054,1091): pass else: - raise e + raise if auto_commit: self.commit() @@ -314,7 +314,7 @@ class Database: # table not found, look in singles pass else: - raise e + raise return self.get_values_from_single(fields, filters, doctype, as_dict, debug) diff --git a/webnotes/model/bean.py b/webnotes/model/bean.py index 1b1cd4e5dc..68e804f5d9 100644 --- a/webnotes/model/bean.py +++ b/webnotes/model/bean.py @@ -357,7 +357,7 @@ class Bean: if webnotes.conn.get_value(self.doc.doctype, self.doc.name, 'docstatus')==2: webnotes.msgprint('[%s "%s" has been cancelled]' % (self.doc.doctype, self.doc.name)) webnotes.errprint(webnotes.utils.getTraceback()) - raise e + raise def save_children(self): child_map = {} diff --git a/webnotes/model/db_schema.py b/webnotes/model/db_schema.py index 198495b97e..b2b3ac84a6 100644 --- a/webnotes/model/db_schema.py +++ b/webnotes/model/db_schema.py @@ -103,7 +103,7 @@ class DbTable: if custom_fl: fl += custom_fl except Exception, e: if e.args[0]!=1146: # ignore no custom field - raise e + raise for f in fl: self.columns[f['fieldname']] = DbColumn(self, f['fieldname'], @@ -305,7 +305,7 @@ class DbManager: else: self.conn.sql("CREATE USER '%s'@'localhost';"%user[:16]) except Exception, e: - raise e + raise def delete_user(self,target): # delete user if exists @@ -315,7 +315,7 @@ class DbManager: if e.args[0]==1396: pass else: - raise e + raise def create_database(self,target): if target in self.get_database_list(): @@ -327,13 +327,13 @@ class DbManager: try: self.conn.sql("DROP DATABASE IF EXISTS `%s`;"%target) except Exception,e: - raise e + raise def grant_all_privileges(self,target,user): try: self.conn.sql("GRANT ALL PRIVILEGES ON `%s`.* TO '%s'@'localhost';" % (target, user)) except Exception,e: - raise e + raise def grant_select_privilges(self,db,table,user): try: @@ -342,13 +342,13 @@ class DbManager: else: self.conn.sql("GRANT SELECT ON %s.* to '%s'@'localhost';" % (db,user)) except Exception,e: - raise e + raise def flush_privileges(self): try: self.conn.sql("FLUSH PRIVILEGES") except Exception,e: - raise e + raise def get_database_list(self): @@ -363,7 +363,7 @@ class DbManager: ret = os.system("mysql -u %s -p%s %s < %s" % \ (esc(user), esc(password), esc(target), source)) except Exception,e: - raise e + raise def drop_table(self,table_name): """drop table if exists""" @@ -372,14 +372,14 @@ class DbManager: try: self.conn.sql("DROP TABLE IF EXISTS %s "%(table_name)) except Exception,e: - raise e + raise def set_transaction_isolation_level(self,scope='SESSION',level='READ COMMITTED'): #Sets the transaction isolation level. scope = global/session try: self.conn.sql("SET %s TRANSACTION ISOLATION LEVEL %s"%(scope,level)) except Exception,e: - raise e + raise def validate_column_name(n): n = n.replace(' ','_').strip().lower() @@ -418,7 +418,7 @@ def remove_all_foreign_keys(): if e.args[0]==1146: fklist = [] else: - raise e + raise for f in fklist: webnotes.conn.sql("alter table `tab%s` drop foreign key `%s`" % (t[0], f[1])) diff --git a/webnotes/model/doc.py b/webnotes/model/doc.py index 5c1bcd25f6..3590be9fc2 100755 --- a/webnotes/model/doc.py +++ b/webnotes/model/doc.py @@ -136,7 +136,7 @@ class Document: if e.args[0]==1146: dataset = None else: - raise e + raise if not dataset: raise webnotes.DoesNotExistError, '[WNF] %s %s does not exist' % (self.doctype, self.name) diff --git a/webnotes/model/doctype.py b/webnotes/model/doctype.py index 9066390413..078d61f8ab 100644 --- a/webnotes/model/doctype.py +++ b/webnotes/model/doctype.py @@ -145,7 +145,7 @@ def add_custom_fields(doctype, doclist): if e.args[0]==1146: return doclist else: - raise e + raise for r in res: custom_field = webnotes.model.doc.Document(fielddata=r) diff --git a/webnotes/model/meta.py b/webnotes/model/meta.py index 05edb664f3..96ed7e8924 100644 --- a/webnotes/model/meta.py +++ b/webnotes/model/meta.py @@ -48,7 +48,7 @@ def get_table_fields(doctype): where dt='%s' and fieldtype='Table'" % doctype, as_list=1)] except Exception, e: if e.args[0]!=1146: - raise e + raise custom_child_tables = [] return child_tables + custom_child_tables diff --git a/webnotes/model/rename_doc.py b/webnotes/model/rename_doc.py index 98f0113a38..f99116eddb 100644 --- a/webnotes/model/rename_doc.py +++ b/webnotes/model/rename_doc.py @@ -53,7 +53,7 @@ def update_attachments(doctype, old, new): where attached_to_name=%s and attached_to_doctype=%s""", (new, old, doctype)) except Exception, e: if e.args[0]!=1054: # in patch? - raise e + raise def rename_parent_and_child(doctype, old, new, doclist): # rename the doc diff --git a/webnotes/model/utils.py b/webnotes/model/utils.py index 42b1fdc047..a37ce636be 100644 --- a/webnotes/model/utils.py +++ b/webnotes/model/utils.py @@ -158,7 +158,7 @@ def delete_doc(doctype=None, name=None, doclist = None, force=0, ignore_doctypes if e.args[0]==1451: webnotes.msgprint("Cannot delete %s '%s' as it is referenced in another record. You must delete the referred record first" % (doctype, name)) - raise e + raise # delete attachments from webnotes.utils.file_manager import remove_all diff --git a/webnotes/translate.py b/webnotes/translate.py index 9b59349d02..9baeab8381 100644 --- a/webnotes/translate.py +++ b/webnotes/translate.py @@ -49,7 +49,7 @@ def get_all_languages(): if e.args[0]==2: return [] else: - raise e + raise def get_lang_dict(): languages_path = os.path.join(get_base_path(), "app", "translations", "languages.json") diff --git a/webnotes/utils/__init__.py b/webnotes/utils/__init__.py index e0a4ba71e9..babbfd6ee9 100644 --- a/webnotes/utils/__init__.py +++ b/webnotes/utils/__init__.py @@ -630,7 +630,7 @@ def get_file_timestamp(fn): return str(cint(os.stat(fn).st_mtime)) except OSError, e: if e.args[0]!=2: - raise e + raise else: return None diff --git a/webnotes/utils/datautils.py b/webnotes/utils/datautils.py index 168760ae84..3cf1658ffa 100644 --- a/webnotes/utils/datautils.py +++ b/webnotes/utils/datautils.py @@ -55,7 +55,7 @@ def read_csv_content(fcontent, ignore_encoding=False): return rows except Exception, e: webnotes.msgprint("Not a valid Comma Separated Value (CSV File)") - raise e + raise @webnotes.whitelist() def send_csv_to_client(args): diff --git a/webnotes/utils/file_manager.py b/webnotes/utils/file_manager.py index 4b62935fb5..0e1bd9eccd 100644 --- a/webnotes/utils/file_manager.py +++ b/webnotes/utils/file_manager.py @@ -209,7 +209,7 @@ def remove_all(dt, dn): attached_to_doctype=%s and attached_to_name=%s""", (dt, dn)): remove_file(fid) except Exception, e: - if e.args[0]!=1054: raise e # (temp till for patched) + if e.args[0]!=1054: raise # (temp till for patched) def remove_file(fid): """Remove file and File Data entry""" diff --git a/webnotes/widgets/form/load.py b/webnotes/widgets/form/load.py index 6dcec2109e..3a0fa0034e 100644 --- a/webnotes/widgets/form/load.py +++ b/webnotes/widgets/form/load.py @@ -37,7 +37,7 @@ def getdoc(doctype, name, user=None): except Exception, e: webnotes.errprint(webnotes.utils.getTraceback()) webnotes.msgprint('Did not load.') - raise e + raise if bean and not name.startswith('_'): webnotes.user.update_recent(doctype, name) diff --git a/webnotes/widgets/form/save.py b/webnotes/widgets/form/save.py index f9cb9141aa..6432341356 100644 --- a/webnotes/widgets/form/save.py +++ b/webnotes/widgets/form/save.py @@ -23,7 +23,7 @@ def savedocs(): except Exception, e: webnotes.msgprint(webnotes._('Did not save')) webnotes.errprint(webnotes.utils.getTraceback()) - raise e + raise @webnotes.whitelist() def cancel(doctype=None, name=None): @@ -36,7 +36,7 @@ def cancel(doctype=None, name=None): except Exception, e: webnotes.errprint(webnotes.utils.getTraceback()) webnotes.msgprint(webnotes._("Did not cancel")) - raise e + raise def send_updated_docs(wrapper): from load import set_docinfo diff --git a/webnotes/widgets/moduleview.py b/webnotes/widgets/moduleview.py index 0cd77cfcf3..be7a059f0e 100644 --- a/webnotes/widgets/moduleview.py +++ b/webnotes/widgets/moduleview.py @@ -28,7 +28,7 @@ def get_doctype_count_from_table(doctype): if e.args[0]==1146: count = None else: - raise e + raise return count def get_report_list(module): diff --git a/webnotes/widgets/tags.py b/webnotes/widgets/tags.py index dec8ee0f81..2924ca6044 100644 --- a/webnotes/widgets/tags.py +++ b/webnotes/widgets/tags.py @@ -105,7 +105,7 @@ class DocTags: self.setup() self.update(dn, tl) - else: raise e + else: raise def setup(self): """adds the _user_tags column if not exists""" diff --git a/wnf.py b/wnf.py index 1b24fd97f4..3201888e3a 100755 --- a/wnf.py +++ b/wnf.py @@ -291,7 +291,7 @@ def latest(site=None, verbose=True): except webnotes.modules.patch_handler.PatchError, e: print "\n".join(webnotes.local.patch_log_list) - raise e + raise finally: webnotes.destroy()