本文整理匯總了Python中globaleaks.settings.GLSettings.log_debug方法的典型用法代碼示例。如果您正苦於以下問題:Python GLSettings.log_debug方法的具體用法?Python GLSettings.log_debug怎麽用?Python GLSettings.log_debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類globaleaks.settings.GLSettings
的用法示例。
在下文中一共展示了GLSettings.log_debug方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _wrap
# 需要導入模塊: from globaleaks.settings import GLSettings [as 別名]
# 或者: from globaleaks.settings.GLSettings import log_debug [as 別名]
def _wrap(self, function, *args, **kwargs):
"""
Wrap provided function calling it inside a thread and
passing the store to it.
"""
self.store = self.get_store()
try:
if self.instance:
result = function(self.instance, self.store, *args, **kwargs)
else:
result = function(self.store, *args, **kwargs)
except exceptions.DisconnectionError as e:
transaction.abort()
# we print the exception here because we do not propagate it
GLSettings.log_debug(e)
result = None
except exceptions.IntegrityError as e:
transaction.abort()
raise DatabaseIntegrityError(str(e))
except HTTPError as excep:
transaction.abort()
raise excep
except:
transaction.abort()
self.store.close()
# propagate the exception
raise
else:
if not self.readonly:
self.store.commit()
else:
self.store.flush()
self.store.invalidate()
finally:
self.store.close()
return result