Catch only Exception according to PEP 352

This commit is contained in:
Cédric Krier committed 2010-07-08 19:53:39 +02:00
1 parent 0c7b1f1fe4
commit 483afed26a
32 files changed
+103 -103

No files matched your search

+1 -1
View File
@@ -146,7 +146,7 @@ class Database(DatabaseInterface):
for db_name, in cursor.fetchall():
try:
database = Database(db_name).connect()
except:
except Exception:
continue
cursor2 = database.cursor()
if cursor2.test():
+3 -3
View File
@@ -327,7 +327,7 @@ class TableHandler(TableHandlerInterface):
self.cursor.execute('ALTER TABLE `%s` ' \
'ADD CONSTRAINT `%s` %s' % \
(self.table_name, ident, constraint,))
except:
except Exception:
if exception:
raise
logging.getLogger('init').warning(
@@ -347,7 +347,7 @@ class TableHandler(TableHandlerInterface):
self.cursor.execute('ALTER TABLE `%s` ' \
'DROP CONSTRAINT `%s`' % \
(self.table_name, ident))
except:
except Exception:
if exception:
raise
logging.getLogger('init').warning(
@@ -363,7 +363,7 @@ class TableHandler(TableHandlerInterface):
'ALTER TABLE `%s` DROP COLUMN `%s`' %
(self.table_name, column_name))
except:
except Exception:
if exception:
raise
logging.getLogger('init').warning(
+2 -2
View File
@@ -191,7 +191,7 @@ class Database(DatabaseInterface):
db_name = db_name.encode('utf-8')
try:
database = Database(db_name).connect()
except:
except Exception:
continue
cursor2 = database.cursor()
if cursor2.test():
@@ -290,7 +290,7 @@ class Cursor(CursorInterface):
res = self.cursor.execute(sql, params)
else:
res = self.cursor.execute(sql)
except:
except Exception:
logger = logging.getLogger('sql')
logger.error('Wrong SQL: ' + (self.cursor.query or ''))
raise
+3 -3
View File
@@ -380,7 +380,7 @@ class TableHandler(TableHandlerInterface):
self.cursor.execute('ALTER TABLE "%s" ' \
'ADD CONSTRAINT "%s" %s' % \
(self.table_name, ident, constraint,))
except:
except Exception:
if exception:
raise
logging.getLogger('init').warning(
@@ -400,7 +400,7 @@ class TableHandler(TableHandlerInterface):
self.cursor.execute('ALTER TABLE "%s" ' \
'DROP CONSTRAINT "%s"' % \
(self.table_name, ident))
except:
except Exception:
if exception:
raise
logging.getLogger('init').warning(
@@ -416,7 +416,7 @@ class TableHandler(TableHandlerInterface):
'ALTER TABLE "%s" DROP COLUMN "%s"' %
(self.table_name, column_name))
except:
except Exception:
if exception:
raise
logging.getLogger('init').warning(
+5 -5
View File
@@ -36,7 +36,7 @@ def extract(lookup_type, date):
microseconds = int(timepart_full[1])
date = datetime.datetime(year, month, day, hours, minutes, seconds,
microseconds)
except:
except Exception:
return None
if lookup_type.lower() == 'century':
return date.year / 100 + (date.year % 100 and 1 or 0)
@@ -65,7 +65,7 @@ def date_trunc(_type, date):
return date
try:
tm_tuple = time.strptime(date, '%Y-%m-%d %H:%M:%S')
except:
except Exception:
return None
if _type == 'year':
return "%i-01-01 00:00:00" % tm_tuple.tm_year
@@ -197,7 +197,7 @@ class Database(DatabaseInterface):
db_name = db_file[:-7]
try:
database = Database(db_name)
except:
except Exception:
continue
cursor2 = database.cursor()
if cursor2.test():
@@ -292,7 +292,7 @@ class Cursor(CursorInterface):
unicode(x, 'utf-8') or x for x in params])
else:
res = self.cursor.execute(sql)
except:
except Exception:
raise
return res
@@ -330,7 +330,7 @@ class Cursor(CursorInterface):
"'ir_translation, '"
"'ir_lang'"
")")
except:
except Exception:
return False
return len(self.cursor.fetchall()) != 0
+12 -12
View File
@@ -128,7 +128,7 @@ class ActionKeyword(ModelSQL, ModelView):
try:
self.pool.get(keyword.model.split(',')[0])\
.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return super(ActionKeyword, self).delete(cursor, user, ids,
context=context)
@@ -140,7 +140,7 @@ class ActionKeyword(ModelSQL, ModelView):
try:
self.pool.get(vals['model'].split(',')[0])\
.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return super(ActionKeyword, self).create(cursor, user, vals,
context=context)
@@ -154,7 +154,7 @@ class ActionKeyword(ModelSQL, ModelView):
try:
self.pool.get(keyword.model.split(',')[0])\
.fields_view_get(cursor.dbname)
except:
except Exception:
pass
res = super(ActionKeyword, self).write(cursor, user, ids, vals,
context=context)
@@ -163,7 +163,7 @@ class ActionKeyword(ModelSQL, ModelView):
try:
self.pool.get(keyword.model.split(',')[0])\
.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
@@ -186,7 +186,7 @@ class ActionKeyword(ModelSQL, ModelView):
context=context):
try:
action_obj = self.pool.get(action_keyword.action.type)
except:
except Exception:
continue
action_id = action_obj.search(cursor, user, [
('action', '=', action_keyword.action.id),
@@ -289,7 +289,7 @@ class ActionReport(ModelSQL, ModelView):
data = base64.encodestring(file_open(
report[name[:-8]].replace('/', os.sep),
mode='rb').read())
except:
except Exception:
data = False
res[report.id] = data
return res
@@ -306,7 +306,7 @@ class ActionReport(ModelSQL, ModelView):
data = base64.encodestring(file_open(
report.style.replace('/', os.sep),
mode='rb').read())
except:
except Exception:
data = False
res[report.id] = data
return res
@@ -453,7 +453,7 @@ class ActionActWindow(ModelSQL, ModelView):
if action.domain:
try:
value = safe_eval(action.domain, CONTEXT)
except:
except Exception:
return False
if isinstance(value, PYSON):
if not value.types() == set([list]):
@@ -463,7 +463,7 @@ class ActionActWindow(ModelSQL, ModelView):
else:
try:
fields.domain_validate(value)
except:
except Exception:
return False
return True
@@ -473,7 +473,7 @@ class ActionActWindow(ModelSQL, ModelView):
if action.context:
try:
value = safe_eval(action.context, CONTEXT)
except:
except Exception:
return False
if isinstance(value, PYSON):
if not value.types() == set([dict]):
@@ -483,7 +483,7 @@ class ActionActWindow(ModelSQL, ModelView):
else:
try:
fields.context_validate(value)
except:
except Exception:
return False
return True
@@ -493,7 +493,7 @@ class ActionActWindow(ModelSQL, ModelView):
if action.search_value:
try:
value = safe_eval(action.search_value, CONTEXT)
except:
except Exception:
return False
if isinstance(value, PYSON):
if not value.types() == set([dict]):
+4 -4
View File
@@ -112,12 +112,12 @@ class Cron(ModelSQL, ModelView):
for line in traceback.format_exception(*sys.exc_info()):
try:
line = line.encode('utf-8', 'ignore')
except:
except Exception:
continue
tb_s += line
try:
tb_s += error.message.decode('utf-8', 'ignore')
except:
except Exception:
pass
request_obj = self.pool.get('res.request')
@@ -143,7 +143,7 @@ class Cron(ModelSQL, ModelView):
'trigger_date': datetime.datetime.now(),
})
cursor.commit()
except:
except Exception:
cursor.rollback()
def pool_jobs(self, db_name):
@@ -151,7 +151,7 @@ class Cron(ModelSQL, ModelView):
try:
database = Database(db_name).connect()
cursor = database.cursor()
except:
except Exception:
return
try:
try:
+2 -2
View File
@@ -114,7 +114,7 @@ class Lang(ModelSQL, ModelView, Cacheable):
for i in grouping:
if not isinstance(i, int):
return False
except:
except Exception:
return False
return True
@@ -126,7 +126,7 @@ class Lang(ModelSQL, ModelView, Cacheable):
try:
datetime_strftime(datetime.datetime.now(),
lang.date.encode('utf-8'))
except:
except Exception:
return False
if '%Y' not in lang.date:
return False
+3 -3
View File
@@ -263,7 +263,7 @@ class ModelAccess(ModelSQL, ModelView):
for _, model in self.pool.iterobject():
try:
model.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
@@ -275,7 +275,7 @@ class ModelAccess(ModelSQL, ModelView):
for _, model in self.pool.iterobject():
try:
model.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
@@ -287,7 +287,7 @@ class ModelAccess(ModelSQL, ModelView):
for _, model in self.pool.iterobject():
try:
model.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
+1 -1
View File
@@ -68,7 +68,7 @@ class Module(ModelSQL, ModelView):
data = file_p.read()
info = tools.safe_eval(data)
file_p.close()
except:
except Exception:
return {}
return info
+1 -1
View File
@@ -75,7 +75,7 @@ class Sequence(ModelSQL, ModelView):
try:
self._process(cursor, user, sequence.prefix)
self._process(cursor, user, sequence.suffix)
except:
except Exception:
return False
return True
+1 -1
View File
@@ -645,7 +645,7 @@ class ReportTranslationSet(Wizard):
style_content = None
try:
style_content = base64.decodestring(report.style_content)
except:
except Exception:
pass
if style_content:
+7 -7
View File
@@ -182,7 +182,7 @@ class View(ModelSQL, ModelView):
for _, model in self.pool.iterobject():
try:
model.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
@@ -192,7 +192,7 @@ class View(ModelSQL, ModelView):
for _, model in self.pool.iterobject():
try:
model.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
@@ -202,7 +202,7 @@ class View(ModelSQL, ModelView):
for _, model in self.pool.iterobject():
try:
model.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
@@ -275,7 +275,7 @@ class ViewTreeWidth(ModelSQL, ModelView):
# Restart the cache
try:
self.pool.get(view.model).fields_view_get(cursor.dbname)
except:
except Exception:
pass
res = super(ViewTreeWidth, self).delete(cursor, user, ids, context=context)
return res
@@ -287,7 +287,7 @@ class ViewTreeWidth(ModelSQL, ModelView):
# Restart the cache
try:
self.pool.get(model).fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
@@ -299,7 +299,7 @@ class ViewTreeWidth(ModelSQL, ModelView):
# Restart the cache
try:
self.pool.get(view.model).fields_view_get(cursor.dbname)
except:
except Exception:
pass
res = super(ViewTreeWidth, self).write(cursor, user, ids, vals, context=context)
views = self.browse(cursor, user, ids)
@@ -307,7 +307,7 @@ class ViewTreeWidth(ModelSQL, ModelView):
# Restart the cache
try:
self.pool.get(view.model).fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
+1 -1
View File
@@ -271,7 +271,7 @@ class EvalEnvironment(dict):
def get(self, item, default=None):
try:
return self.__getitem__(item)
except:
except Exception:
pass
return super(EvalEnvironment, self).get(item, default)
+2 -2
View File
@@ -66,11 +66,11 @@ class Reference(Field):
ref_id_found.setdefault(ref_model, set())
try:
ref_id = safe_eval(ref_id)
except:
except Exception:
pass
try:
ref_id = int(ref_id)
except:
except Exception:
continue
ctx = context.copy()
ctx['active_test'] = False
+1 -1
View File
@@ -102,7 +102,7 @@ class ModelSQL(ModelStorage):
try: # XXX ugly hack: some default fct try
# to access the non-existing table
result = fun(*a)
except:
except Exception:
return None
clean_results = self._clean_defaults(
{field_name: result})
+4 -4
View File
@@ -322,7 +322,7 @@ class ModelStorage(Model):
try:
data[field_name] = data[field_name] and \
data[field_name][0]
except:
except Exception:
pass
elif ftype in ('one2many',):
if data[field_name]:
@@ -728,7 +728,7 @@ class ModelStorage(Model):
return False
try:
relation, value = value.split(',', 1)
except:
except Exception:
warn('reference_syntax_error', value, '/'.join(field))
return False
relation_obj = self.pool.get(relation)
@@ -756,7 +756,7 @@ class ModelStorage(Model):
elif ftype == 'reference':
try:
relation, value = value.split(',', 1)
except:
except Exception:
warn('reference_syntax_error', value, '/'.join(field))
return False
value = [value]
@@ -766,7 +766,7 @@ class ModelStorage(Model):
for word in value:
try:
module, xml_id = word.rsplit('.', 1)
except:
except Exception:
warn('xml_id_syntax_error', word, '/'.join(field))
continue
db_id = ir_model_data_obj.get_id(cursor, user,
+1 -1
View File
@@ -330,7 +330,7 @@ class ModelView(Model):
relation = field.model_name
else:
relation = field.get_target(self.pool)._name
except:
except Exception:
relation = False
if relation and element.tag == 'field':
childs = False
+2 -2
View File
@@ -153,7 +153,7 @@ def create_graph(module_list, force=None):
try:
info = tools.safe_eval(tools.file_open(tryton_file,
subdir='').read())
except:
except Exception:
logger.error('%s:eval file %s' % (module, tryton_file))
raise
packages.append((module, info.get('depends', []), info))
@@ -434,7 +434,7 @@ def load_modules(database_name, pool, update=False, lang=None):
try:
load_module_graph(cursor, graph, pool, lang)
except:
except Exception:
cursor.rollback()
raise
+1 -1
View File
@@ -24,7 +24,7 @@ def _modified(path):
if mtime != _TIMES[path]:
_TIMES[path] = mtime
return True
except:
except Exception:
return True
finally:
_LOCK.release()
+1 -1
View File
@@ -73,7 +73,7 @@ class Pool(object):
Pool.classes[type] = {}
try:
register_classes(reload_p=reload_p)
except:
except Exception:
if not reload_p:
raise
for type in prev_classes:
+5 -5
View File
@@ -63,7 +63,7 @@ def dispatch(host, port, protocol, database_name, user, session, object_type,
cursor = database.cursor()
cursor.close(close=True)
return True
except:
except Exception:
return False
elif method == 'list':
database = Database().connect()
@@ -71,7 +71,7 @@ def dispatch(host, port, protocol, database_name, user, session, object_type,
cursor = database.cursor()
res = database.list(cursor)
cursor.close(close=True)
except:
except Exception:
res = []
return res
elif method == 'create':
@@ -206,7 +206,7 @@ def create(database_name, password, lang, admin_password):
module_obj.update_list(cursor, 0)
cursor.commit()
res = True
except:
except Exception:
logger.error('CREATE DB: %s failed' % (database_name,))
tb_s = reduce(lambda x, y: x+y,
traceback.format_exception(*sys.exc_info()))
@@ -232,7 +232,7 @@ def drop(database_name, password):
try:
database.drop(cursor, database_name)
cursor.commit()
except:
except Exception:
logger.error('DROP DB: %s failed' % (database_name,))
tb_s = reduce(lambda x, y: x+y,
traceback.format_exception(*sys.exc_info()))
@@ -264,7 +264,7 @@ def restore(database_name, password, data, update=False):
cursor = database.cursor()
cursor.close(close=True)
raise Exception("Database already exists!")
except:
except Exception:
pass
data = base64.decodestring(data)
Database.restore(database_name, data)
+4 -4
View File
@@ -92,12 +92,12 @@ class SimpleJSONRPCDispatcher(SimpleXMLRPCServer.SimpleXMLRPCDispatcher):
response['result'] = dispatch_method(method, params)
else:
response['result'] = self._dispatch(method, params)
except:
except Exception:
tb_s = ''
for line in traceback.format_exception(*sys.exc_info()):
try:
line = line.encode('utf-8', 'ignore')
except:
except Exception:
continue
tb_s += line
for path in sys.path:
@@ -175,7 +175,7 @@ class SimpleJSONRPCRequestHandler(GenericJSONRPCRequestHandler,
response = self.server._marshaled_dispatch(
data, getattr(self, '_dispatch', None)
)
except: # This should only happen if the module is buggy
except Exception: # This should only happen if the module is buggy
# internal error, report as HTTP server error
self.send_response(500)
self.end_headers()
@@ -314,7 +314,7 @@ class JSONRPCDaemon(threading.Thread):
try:
socket.getaddrinfo(interface or None, port, socket.AF_INET6)
ipv6 = True
except:
except Exception:
pass
if secure:
handler_class = SecureJSONRPCRequestHandler
+9 -9
View File
@@ -23,7 +23,7 @@ class NetRPCClientThread(threading.Thread):
self.running = True
try:
pysocket = PySocket(self.sock)
except:
except Exception:
self.sock.close()
self.threads.remove(self)
return False
@@ -38,7 +38,7 @@ class NetRPCClientThread(threading.Thread):
timeout = 0
try:
msg = pysocket.receive()
except:
except Exception:
pysocket.disconnect()
self.threads.remove(self)
return False
@@ -51,7 +51,7 @@ class NetRPCClientThread(threading.Thread):
for line in traceback.format_exception(*sys.exc_info()):
try:
line = line.encode('utf-8', 'ignore')
except:
except Exception:
continue
tb_s += line
for path in sys.path:
@@ -63,7 +63,7 @@ class NetRPCClientThread(threading.Thread):
try:
pysocket.send(exception.args, exception=True,
traceback=tb_s)
except:
except Exception:
pysocket.disconnect()
self.threads.remove(self)
return False
@@ -83,7 +83,7 @@ class NetRPCServerThread(threading.Thread):
try:
socket.getaddrinfo(interface or None, port, socket.AF_INET6)
self.socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
except:
except Exception:
pass
if self.socket is None:
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -107,10 +107,10 @@ class NetRPCServerThread(threading.Thread):
self.secure)
self.threads.append(c_thread)
c_thread.start()
except:
except Exception:
try:
self.socket.close()
except:
except Exception:
pass
return False
@@ -121,7 +121,7 @@ class NetRPCServerThread(threading.Thread):
thread = self.threads[0]
thread.stop()
thread.join()
except:
except Exception:
pass
try:
if hasattr(socket, 'SHUT_RDWR'):
@@ -129,5 +129,5 @@ class NetRPCServerThread(threading.Thread):
else:
self.socket.shutdown(2)
self.socket.close()
except:
except Exception:
return False
+3 -3
View File
@@ -65,7 +65,7 @@ if not hasattr(WebDAVServer.DAVRequestHandler, '_config'):
def get(self, name, default=None):
try:
return self[name]
except:
except Exception:
return default
@@ -107,7 +107,7 @@ class WebDAVServerThread(threading.Thread):
try:
socket.getaddrinfo(interface or None, port, socket.AF_INET6)
ipv6 = True
except:
except Exception:
pass
if secure:
handler_class = SecureWebDAVAuthRequestHandler
@@ -193,7 +193,7 @@ class TrytonDAVInterface(iface.dav_interface):
try:
cursor = database.cursor()
lists = database.list(cursor)
except:
except Exception:
lists = []
finally:
cursor.close()
+5 -5
View File
@@ -63,12 +63,12 @@ class GenericXMLRPCRequestHandler:
}
return dispatch(host, port, 'XML-RPC', database_name, user,
session, object_type, object_name, method, *params)
except:
except Exception:
tb_s = ''
for line in traceback.format_exception(*sys.exc_info()):
try:
line = line.encode('utf-8', 'ignore')
except:
except Exception:
continue
tb_s += line
for path in sys.path:
@@ -101,7 +101,7 @@ class SimpleXMLRPCRequestHandler(GenericXMLRPCRequestHandler,
password)
self.tryton = {'user': user_id, 'session': session}
return res
except:
except Exception:
pass
self.send_error(401, 'Unauthorized')
self.send_header("WWW-Authenticate", 'Basic realm="Tryton"')
@@ -142,7 +142,7 @@ class SimpleXMLRPCRequestHandler(GenericXMLRPCRequestHandler,
response = self.server._marshaled_dispatch(
data, getattr(self, '_dispatch', None)
)
except: # This should only happen if the module is buggy
except Exception: # This should only happen if the module is buggy
# internal error, report as HTTP server error
self.send_response(500)
self.end_headers()
@@ -219,7 +219,7 @@ class XMLRPCDaemon(threading.Thread):
try:
socket.getaddrinfo(interface or None, port, socket.AF_INET6)
ipv6 = True
except:
except Exception:
pass
if secure:
handler_class = SecureXMLRPCRequestHandler
+5 -5
View File
@@ -57,7 +57,7 @@ class PySocket:
socket.SOCK_STREAM)
self.sock.settimeout(CONNECT_TIMEOUT)
self.sock.connect((host, int(port)))
except:
except Exception:
self.sock = None
if self.sock is None:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -72,7 +72,7 @@ class PySocket:
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
sock.settimeout(CONNECT_TIMEOUT)
sock.connect((host, int(port)))
except:
except Exception:
sock = None
if sock is None:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -84,7 +84,7 @@ class PySocket:
elif hasattr(socket, 'ssl'):
socket.ssl(sock)
self.ssl = True
except:
except Exception:
pass
self.sock.settimeout(TIMEOUT)
if self.ssl:
@@ -111,10 +111,10 @@ class PySocket:
sock.sock_shutdown(shutdown_value)
else:
sock.shutdown(shutdown_value)
except:
except Exception:
pass
sock.close()
except:
except Exception:
pass
self.sock = None
self.ssl = False
+1 -1
View File
@@ -183,7 +183,7 @@ class User(ModelSQL, ModelView):
for _, model in self.pool.iterobject():
try:
model.fields_view_get(cursor.dbname)
except:
except Exception:
pass
return res
+1 -1
View File
@@ -232,7 +232,7 @@ class TrytonServer(object):
if CONFIG['auto_reload'] and monitor():
try:
Pool.start()
except:
except Exception:
pass
for dbname in Pool.database_list():
pool = Pool(dbname)
+4 -4
View File
@@ -433,7 +433,7 @@ class TrytondXmlHandler(sax.handler.ContentHandler):
try:
self.sax_parser.parse(source)
except:
except Exception:
logging.getLogger("convert").error(
"Error while parsing xml file:\n" +\
self.current_state()
@@ -524,7 +524,7 @@ class TrytondXmlHandler(sax.handler.ContentHandler):
ref_mode, ref_id = browse_record[key].split(',', 1)
try:
ref_id = safe_eval(ref_id)
except:
except Exception:
pass
if isinstance(ref_id, (list, tuple)):
ref_id = ref_id[0]
@@ -1001,7 +1001,7 @@ def post_import(cursor, pool, module, to_delete):
model_obj.delete(cursor, user, db_id)
mdata_delete.append(mdata_id)
cursor.commit()
except:
except Exception:
cursor.rollback()
tb_s = reduce(lambda x, y: x + y,
traceback.format_exception(*sys.exc_info()))
@@ -1022,7 +1022,7 @@ def post_import(cursor, pool, module, to_delete):
transition_obj.delete(cursor, user, db_id)
mdata_delete.append(mdata_id)
cursor.commit()
except:
except Exception:
cursor.rollback()
logging.getLogger("convert").error(
'Could not delete id: %d of model workflow.transition' %
+1 -1
View File
@@ -133,7 +133,7 @@ def file_open(name, mode="r", subdir='modules'):
return StringIO.StringIO(zfile.read(os.path.join(
os.path.basename(head), zipname).replace(
os.sep, '/')))
except:
except Exception:
name2 = os.path.normpath(os.path.join(head + '.zip', zipname))
for i in (name2, name, name3):
if i and os.path.isfile(i):
+7 -7
View File
@@ -359,7 +359,7 @@ class Collection(ModelSQL, ModelView):
try:
if attachment.datas_size:
size = str(attachment.datas_size)
except:
except Exception:
pass
if attachment.id == object_id:
res = size
@@ -480,7 +480,7 @@ class Collection(ModelSQL, ModelView):
try:
if attachment.datas is not False:
data = base64.decodestring(attachment.datas)
except:
except Exception:
pass
if attachment.id == object_id:
res = data
@@ -527,14 +527,14 @@ class Collection(ModelSQL, ModelView):
'name': name,
'resource': '%s,%s' % (object_name, object_id),
}, context=context)
except:
except Exception:
raise DAV_Forbidden
else:
try:
attachment_obj.write(cursor, user, object_id2, {
'datas': base64.encodestring(data or ''),
}, context=context)
except:
except Exception:
raise DAV_Forbidden
return
@@ -553,7 +553,7 @@ class Collection(ModelSQL, ModelView):
'name': name,
'parent': object_id,
}, context=context)
except:
except Exception:
raise DAV_Forbidden
return 201
@@ -566,7 +566,7 @@ class Collection(ModelSQL, ModelView):
raise DAV_Forbidden
try:
self.delete(cursor, user, object_id, context=context)
except:
except Exception:
raise DAV_Forbidden
return 200
@@ -582,7 +582,7 @@ class Collection(ModelSQL, ModelView):
model_obj = self.pool.get(object_name)
try:
model_obj.delete(cursor, user, object_id, context=context)
except:
except Exception:
raise DAV_Forbidden
return 200