[minor] replace 'raise e' with 'raise' for correct tracebacks

This commit is contained in:
Anand Doshi 2013-11-12 17:27:09 +05:30
parent dae173cf39
commit c754276fc0
19 changed files with 33 additions and 33 deletions

View file

@ -311,4 +311,4 @@ def make_module_and_roles(doclist, perm_doctype="DocPerm"):
if e.args[0]==1146:
pass
else:
raise e
raise

View file

@ -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

View file

@ -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)

View file

@ -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 = {}

View file

@ -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]))

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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):

View file

@ -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"""

View file

@ -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)

View file

@ -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

View file

@ -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):

View file

@ -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"""

2
wnf.py
View file

@ -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()