Commit c0fb8e54 authored by Vincent Pelletier's avatar Vincent Pelletier

all: Use zLOG.LOG(..., error=True) instead of immediate exc_info.

Simpler, and reduces the exposure of exc_info (which can be tricky to use
in other contexts).
parent 10a678e1
...@@ -37,8 +37,6 @@ from Products.ERP5Type.Cache import transactional_cached ...@@ -37,8 +37,6 @@ from Products.ERP5Type.Cache import transactional_cached
# IMAP imports # IMAP imports
import imaplib import imaplib
import sys
# Transaction Management # Transaction Management
from Shared.DC.ZRDB.TM import TM from Shared.DC.ZRDB.TM import TM
...@@ -107,7 +105,7 @@ class IMAPSServer(MailServer): ...@@ -107,7 +105,7 @@ class IMAPSServer(MailServer):
self.server.logout() self.server.logout()
except: except:
LOG('IMAPSServer', ERROR, "exception during _finish", LOG('IMAPSServer', ERROR, "exception during _finish",
error=sys.exc_info()) error=True)
raise raise
def _abort(self, *ignored): def _abort(self, *ignored):
...@@ -123,7 +121,7 @@ class IMAPSServer(MailServer): ...@@ -123,7 +121,7 @@ class IMAPSServer(MailServer):
self.server.logout() self.server.logout()
except: except:
LOG('IMAPSServer', ERROR, "exception during _abort", LOG('IMAPSServer', ERROR, "exception during _abort",
error=sys.exc_info()) error=True)
raise raise
def _selectMessageFolder(self, message_folder): def _selectMessageFolder(self, message_folder):
......
...@@ -377,7 +377,7 @@ CREATE TABLE %s ( ...@@ -377,7 +377,7 @@ CREATE TABLE %s (
def _log(self, severity, summary): def _log(self, severity, summary):
LOG(self.__class__.__name__, severity, summary, LOG(self.__class__.__name__, severity, summary,
error=severity>INFO and sys.exc_info() or None) error=severity > INFO)
def distribute(self, activity_tool, node_count): def distribute(self, activity_tool, node_count):
db = activity_tool.getSQLConnection() db = activity_tool.getSQLConnection()
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
from Shared.DC.ZRDB.TM import TM from Shared.DC.ZRDB.TM import TM
from zLOG import LOG, ERROR from zLOG import LOG, ERROR
import sys
from collections import defaultdict from collections import defaultdict
import transaction import transaction
...@@ -66,7 +65,7 @@ class ActivityBuffer(TM): ...@@ -66,7 +65,7 @@ class ActivityBuffer(TM):
self.activity_tool = None self.activity_tool = None
except: except:
LOG('ActivityBuffer', ERROR, "exception during _prepare", LOG('ActivityBuffer', ERROR, "exception during _prepare",
error=sys.exc_info()) error=True)
raise raise
def deferredQueueMessage(self, activity_tool, activity, message): def deferredQueueMessage(self, activity_tool, activity, message):
......
...@@ -269,7 +269,7 @@ class Message(BaseMessage): ...@@ -269,7 +269,7 @@ class Message(BaseMessage):
obj = self._getObject(activity_tool) obj = self._getObject(activity_tool)
except KeyError: except KeyError:
LOG('CMFActivity', WARNING, "Message dropped (no object found at path %r)" LOG('CMFActivity', WARNING, "Message dropped (no object found at path %r)"
% (self.object_path,), error=sys.exc_info()) % (self.object_path,), error=True)
self.setExecutionState(MESSAGE_NOT_EXECUTABLE) self.setExecutionState(MESSAGE_NOT_EXECUTABLE)
else: else:
if (self.oid and self.oid != getattr(aq_base(obj), '_p_oid', None) and if (self.oid and self.oid != getattr(aq_base(obj), '_p_oid', None) and
...@@ -1277,7 +1277,7 @@ class ActivityTool (BaseTool): ...@@ -1277,7 +1277,7 @@ class ActivityTool (BaseTool):
except: except:
# Catch ALL exception to avoid killing timerserver. # Catch ALL exception to avoid killing timerserver.
LOG('ActivityTool', ERROR, 'process_timer received an exception', LOG('ActivityTool', ERROR, 'process_timer received an exception',
error=sys.exc_info()) error=True)
finally: finally:
setSecurityManager(old_sm) setSecurityManager(old_sm)
finally: finally:
......
...@@ -59,7 +59,6 @@ from hashlib import md5 ...@@ -59,7 +59,6 @@ from hashlib import md5
from warnings import warn from warnings import warn
from cPickle import loads, dumps from cPickle import loads, dumps
from copy import deepcopy from copy import deepcopy
from sys import exc_info
MYSQL_MIN_DATETIME_RESOLUTION = 1/86400. MYSQL_MIN_DATETIME_RESOLUTION = 1/86400.
...@@ -1400,7 +1399,7 @@ class SimulationTool(BaseTool): ...@@ -1400,7 +1399,7 @@ class SimulationTool(BaseTool):
except TypeError: except TypeError:
LOG("SimulationTool._getCachedInventoryList", WARNING, LOG("SimulationTool._getCachedInventoryList", WARNING,
"Failed copying sql_kw, disabling stock cache", "Failed copying sql_kw, disabling stock cache",
error=exc_info()) error=True)
raise StockOptimisationError raise StockOptimisationError
no_date_sql_kw, no_date_new_kw = self._generateKeywordDict(**no_date_kw) no_date_sql_kw, no_date_new_kw = self._generateKeywordDict(**no_date_kw)
no_date_stock_sql_kw = self._generateSQLKeywordDictFromKeywordDict( no_date_stock_sql_kw = self._generateSQLKeywordDictFromKeywordDict(
......
...@@ -40,7 +40,6 @@ from Products.ERP5Type import Permissions ...@@ -40,7 +40,6 @@ from Products.ERP5Type import Permissions
from Products.CMFCore.utils import getToolByName, _checkConditionalGET, _setCacheHeaders, _ViewEmulator from Products.CMFCore.utils import getToolByName, _checkConditionalGET, _setCacheHeaders, _ViewEmulator
from OFS.Image import File as OFSFile from OFS.Image import File as OFSFile
from warnings import warn from warnings import warn
import sys
from base64 import decodestring from base64 import decodestring
from Products.ERP5Type.UnrestrictedMethod import unrestricted_apply from Products.ERP5Type.UnrestrictedMethod import unrestricted_apply
from Products.ERP5.Document.Document import ConversionError, NotConvertedError from Products.ERP5.Document.Document import ConversionError, NotConvertedError
...@@ -125,7 +124,7 @@ class BaseExtensibleTraversableMixin(ExtensibleTraversableMixIn): ...@@ -125,7 +124,7 @@ class BaseExtensibleTraversableMixin(ExtensibleTraversableMixIn):
except: except:
LOG("ERP5 WARNING",0, LOG("ERP5 WARNING",0,
"Failed to retrieve user in __bobo_traverse__ of WebSection %s" % self.getPath(), "Failed to retrieve user in __bobo_traverse__ of WebSection %s" % self.getPath(),
error=sys.exc_info()) error=True)
user = None user = None
if user is not None and user.getUserName() == 'Anonymous User': if user is not None and user.getUserName() == 'Anonymous User':
user = None # If the user which is connected is anonymous, user = None # If the user which is connected is anonymous,
......
...@@ -51,7 +51,6 @@ from zExceptions import Forbidden ...@@ -51,7 +51,6 @@ from zExceptions import Forbidden
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
import sys
class FieldValueCacheDict(dict): class FieldValueCacheDict(dict):
_last_sync = -1 _last_sync = -1
...@@ -237,7 +236,7 @@ class TALESValue(StaticValue): ...@@ -237,7 +236,7 @@ class TALESValue(StaticValue):
# something reasonable rather than generate plenty of errors # something reasonable rather than generate plenty of errors
LOG('ERP5Form', PROBLEM, LOG('ERP5Form', PROBLEM,
'Field.get_value %r [%s], exception on tales_expr: ' % 'Field.get_value %r [%s], exception on tales_expr: ' %
(field, id), error=sys.exc_info()) (field, id), error=True)
# field may be ProxyField # field may be ProxyField
# here we avoid calling field.get_recursive_orig_value # here we avoid calling field.get_recursive_orig_value
# on all fields because it can be acquired from another # on all fields because it can be acquired from another
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
# #
############################################################################## ##############################################################################
import sys
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.ZopeGuards import guarded_getattr from AccessControl.ZopeGuards import guarded_getattr
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
...@@ -381,7 +380,7 @@ class MatrixBoxWidget(Widget.Widget): ...@@ -381,7 +380,7 @@ class MatrixBoxWidget(Widget.Widget):
except: except:
LOG('MatrixBox', WARNING, 'Could not evaluate the url ' LOG('MatrixBox', WARNING, 'Could not evaluate the url '
'method %r with %r' % (url_method, cell), 'method %r with %r' % (url_method, cell),
error=sys.exc_info()) error=True)
else: else:
LOG('MatrixBox', WARNING, LOG('MatrixBox', WARNING,
'Could not find the url method %s' % (url_method_id,)) 'Could not find the url method %s' % (url_method_id,))
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
# #
############################################################################## ##############################################################################
import sys
from Acquisition import Implicit from Acquisition import Implicit
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
...@@ -243,7 +241,7 @@ class OOoParser(Implicit): ...@@ -243,7 +241,7 @@ class OOoParser(Implicit):
try: try:
oo_unzipped = ZipFile(file_descriptor, mode="r") oo_unzipped = ZipFile(file_descriptor, mode="r")
except Exception, e: except Exception, e:
LOG('ERP5OOo', DEBUG, 'Error in openFile', error=sys.exc_info()) LOG('ERP5OOo', DEBUG, 'Error in openFile', error=True)
raise CorruptedOOoFile(e) raise CorruptedOOoFile(e)
# Test the integrity of the file # Test the integrity of the file
if oo_unzipped.testzip() is not None: if oo_unzipped.testzip() is not None:
......
...@@ -28,7 +28,6 @@ from Products.PluggableAuthService.interfaces.plugins import IUserEnumerationPlu ...@@ -28,7 +28,6 @@ from Products.PluggableAuthService.interfaces.plugins import IUserEnumerationPlu
from Products.ERP5Type.Cache import CachingMethod, transactional_cached from Products.ERP5Type.Cache import CachingMethod, transactional_cached
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import sys
from DateTime import DateTime from DateTime import DateTime
from zLOG import LOG, PROBLEM from zLOG import LOG, PROBLEM
from Products import ERP5Security from Products import ERP5Security
...@@ -294,7 +293,7 @@ class ERP5UserManager(BasePlugin): ...@@ -294,7 +293,7 @@ class ERP5UserManager(BasePlugin):
except ConflictError: except ConflictError:
raise raise
except: except:
LOG('ERP5Security', PROBLEM, 'getUserByLogin failed', error=sys.exc_info()) LOG('ERP5Security', PROBLEM, 'getUserByLogin failed', error=True)
# Here we must raise an exception to prevent callers from caching # Here we must raise an exception to prevent callers from caching
# a result of a degraded situation. # a result of a degraded situation.
# The kind of exception does not matter as long as it's catched by # The kind of exception does not matter as long as it's catched by
......
...@@ -74,7 +74,7 @@ for handler_id, module_id in handler_module_dict.iteritems(): ...@@ -74,7 +74,7 @@ for handler_id, module_id in handler_module_dict.iteritems():
LOG('ERP5TioSafe.__init__', WARNING, LOG('ERP5TioSafe.__init__', WARNING,
'Unable to import module %r. %r transport will not be available.' % \ 'Unable to import module %r. %r transport will not be available.' % \
(module_id, handler_id), (module_id, handler_id),
error=sys.exc_info()) error=True)
else: else:
try: try:
registerConnectionPlugin(handler_id, getattr(module, module_id)) registerConnectionPlugin(handler_id, getattr(module, module_id))
...@@ -82,4 +82,4 @@ for handler_id, module_id in handler_module_dict.iteritems(): ...@@ -82,4 +82,4 @@ for handler_id, module_id in handler_module_dict.iteritems():
LOG('ERP5TioSafe.ConnectionPlugin.__init__', WARNING, LOG('ERP5TioSafe.ConnectionPlugin.__init__', WARNING,
'Unable to register module %r. error is %r.' % \ 'Unable to register module %r. error is %r.' % \
(module_id, msg), (module_id, msg),
error=sys.exc_info()) error=True)
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
# #
############################################################################## ##############################################################################
import sys
from Products.CMFCore.Expression import Expression from Products.CMFCore.Expression import Expression
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
...@@ -80,7 +78,7 @@ class TALESConstraint(Constraint): ...@@ -80,7 +78,7 @@ class TALESConstraint(Constraint):
raise raise
except Exception, e: except Exception, e:
LOG('ERP5Type', PROBLEM, 'TALESConstraint error on "%s" on %s' % LOG('ERP5Type', PROBLEM, 'TALESConstraint error on "%s" on %s' %
(self.constraint_definition['expression'], obj), error=sys.exc_info()) (self.constraint_definition['expression'], obj), error=True)
error_list.append(self._generateError(obj, error_list.append(self._generateError(obj,
self._getMessage('message_expression_error'), self._getMessage('message_expression_error'),
mapping=dict(error_text=str(e)))) mapping=dict(error_text=str(e))))
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
# #
############################################################################## ##############################################################################
import sys
from Products.ERP5Type.mixin.constraint import ConstraintMixin from Products.ERP5Type.mixin.constraint import ConstraintMixin
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
from zLOG import LOG, PROBLEM from zLOG import LOG, PROBLEM
...@@ -79,7 +77,7 @@ class TALESConstraint(ConstraintMixin): ...@@ -79,7 +77,7 @@ class TALESConstraint(ConstraintMixin):
raise raise
except Exception, e: except Exception, e:
LOG('ERP5Type', PROBLEM, 'TALESConstraint error on "%s" on %s' % LOG('ERP5Type', PROBLEM, 'TALESConstraint error on "%s" on %s' %
(expression_text, obj), error=sys.exc_info()) (expression_text, obj), error=True)
return [self._generateError(obj, return [self._generateError(obj,
self._getMessage('message_expression_error'), self._getMessage('message_expression_error'),
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
# #
############################################################################## ##############################################################################
import sys
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass, DTMLFile from Products.ERP5Type.Globals import InitializeClass, DTMLFile
...@@ -69,7 +68,7 @@ for handler_id, module_id in handler_module_dict.iteritems(): ...@@ -69,7 +68,7 @@ for handler_id, module_id in handler_module_dict.iteritems():
LOG('WebServiceTool', WARNING, LOG('WebServiceTool', WARNING,
'Unable to import module %r. %r transport will not be available.' % \ 'Unable to import module %r. %r transport will not be available.' % \
(module_id, handler_id), (module_id, handler_id),
error=sys.exc_info()) error=True)
else: else:
registerConnectionPlugin(handler_id, getattr(module, module_id)) registerConnectionPlugin(handler_id, getattr(module, module_id))
......
...@@ -1052,7 +1052,7 @@ def initializeLocalRegistry(directory_name, import_local_method): ...@@ -1052,7 +1052,7 @@ def initializeLocalRegistry(directory_name, import_local_method):
raise raise
LOG('E5RP5Type', PROBLEM, LOG('E5RP5Type', PROBLEM,
'Failed to add local %s to ERP5Type repository: %s (%s)' 'Failed to add local %s to ERP5Type repository: %s (%s)'
% (directory_name, module_name, document_path), error=e) % (directory_name, module_name, document_path), error=True)
def initializeLocalDocumentRegistry(): def initializeLocalDocumentRegistry():
# XXX Arg are not consistent # XXX Arg are not consistent
...@@ -1368,7 +1368,7 @@ def assertAttributePortalType(o, attribute_name, portal_type): ...@@ -1368,7 +1368,7 @@ def assertAttributePortalType(o, attribute_name, portal_type):
o._delObject(attribute_name) o._delObject(attribute_name)
except (KeyError, AttributeError), err: except (KeyError, AttributeError), err:
LOG('ERP5Type', PROBLEM, "assertAttributePortalType failed on %s" % o, LOG('ERP5Type', PROBLEM, "assertAttributePortalType failed on %s" % o,
error=err) error=True)
##################################################### #####################################################
# Miscellaneous # Miscellaneous
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.Accessor.Constant import Getter as ConstantGetter from Products.ERP5Type.Accessor.Constant import Getter as ConstantGetter
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
...@@ -117,7 +115,7 @@ class GhostBaseMetaClass(ExtensionClass, AccessorHolderType): ...@@ -117,7 +115,7 @@ class GhostBaseMetaClass(ExtensionClass, AccessorHolderType):
raise raise
except Exception, e: except Exception, e:
LOG('lazy_class.__getattribute__', WARNING, 'Failed to load class : %r' % (e,), LOG('lazy_class.__getattribute__', WARNING, 'Failed to load class : %r' % (e,),
error=sys.exc_info()) error=True)
raise raise
return getattr(self, attr) return getattr(self, attr)
...@@ -353,7 +351,7 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): ...@@ -353,7 +351,7 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
except AttributeError: except AttributeError:
LOG("ERP5Type.Dynamic", WARNING, LOG("ERP5Type.Dynamic", WARNING,
"Could not access Portal Type Object for type %r" "Could not access Portal Type Object for type %r"
% portal_type, error=sys.exc_info()) % portal_type, error=True)
base_tuple = (ERP5BaseBroken, ) base_tuple = (ERP5BaseBroken, )
portal_type_category_list = [] portal_type_category_list = []
attribute_dict = dict(_categories=[], constraints=[]) attribute_dict = dict(_categories=[], constraints=[])
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
# #
############################################################################## ##############################################################################
import sys
import os import os
import inspect import inspect
import transaction import transaction
...@@ -441,7 +440,7 @@ def synchronizeDynamicModules(context, force=False): ...@@ -441,7 +440,7 @@ def synchronizeDynamicModules(context, force=False):
# Required because the exception may be silently dropped by the caller. # Required because the exception may be silently dropped by the caller.
transaction.doom() transaction.doom()
LOG('ERP5Site', PANIC, "Automatic migration of core tools failed", LOG('ERP5Site', PANIC, "Automatic migration of core tools failed",
error=sys.exc_info()) error=True)
raise raise
LOG("ERP5Type.dynamic", 0, "Resetting dynamic classes") LOG("ERP5Type.dynamic", 0, "Resetting dynamic classes")
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
############################################################################## ##############################################################################
# Stribger repair of BTreeFolder2 # Stribger repair of BTreeFolder2
import sys
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base
from Acquisition import aq_base from Acquisition import aq_base
from BTrees.OOBTree import OOBTree from BTrees.OOBTree import OOBTree
...@@ -72,7 +71,7 @@ def _cleanup(self): ...@@ -72,7 +71,7 @@ def _cleanup(self):
except (AssertionError, KeyError): except (AssertionError, KeyError):
LOG('BTreeFolder2', WARNING, LOG('BTreeFolder2', WARNING,
'Detected damage to %s. Fixing now.' % path, 'Detected damage to %s. Fixing now.' % path,
error=sys.exc_info()) error=True)
try: try:
self._tree = OOBTree(self._tree) self._tree = OOBTree(self._tree)
mt_index = OOBTree() mt_index = OOBTree()
...@@ -89,7 +88,7 @@ def _cleanup(self): ...@@ -89,7 +88,7 @@ def _cleanup(self):
self._mt_index = OOBTree(mt_index) self._mt_index = OOBTree(mt_index)
except: except:
LOG('BTreeFolder2', ERROR, 'Failed to fix %s.' % path, LOG('BTreeFolder2', ERROR, 'Failed to fix %s.' % path,
error=sys.exc_info()) error=True)
raise raise
else: else:
LOG('BTreeFolder2', INFO, 'Fixed %s.' % path) LOG('BTreeFolder2', INFO, 'Fixed %s.' % path)
......
...@@ -27,7 +27,6 @@ from Acquisition import aq_base, aq_parent ...@@ -27,7 +27,6 @@ from Acquisition import aq_base, aq_parent
from zLOG import LOG, INFO, ERROR from zLOG import LOG, INFO, ERROR
from cStringIO import StringIO from cStringIO import StringIO
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
import sys
security = ClassSecurityInfo() security = ClassSecurityInfo()
DA.security = security DA.security = security
...@@ -224,7 +223,7 @@ def DA__call__(self, REQUEST=None, __ick__=None, src__=0, test__=0, **kw): ...@@ -224,7 +223,7 @@ def DA__call__(self, REQUEST=None, __ick__=None, src__=0, test__=0, **kw):
# LOG("DA query", INFO, "query = %s" %(query,)) # LOG("DA query", INFO, "query = %s" %(query,))
result=DB__.query(query, self.max_rows_) result=DB__.query(query, self.max_rows_)
except: except:
LOG("DA call raise", ERROR, "DB = %s, c = %s, query = %s" %(DB__, c, query), error=sys.exc_info()) LOG("DA call raise", ERROR, "DB = %s, c = %s, query = %s" %(DB__, c, query), error=True)
raise raise
# patch: dynamic brain configuration # patch: dynamic brain configuration
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# #
############################################################################## ##############################################################################
import sys
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from types import StringTypes from types import StringTypes
...@@ -565,7 +564,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False): ...@@ -565,7 +564,7 @@ def WorkflowTool_listActions(self, info=None, object=None, src__=False):
LOG('WorkflowTool.listActions', WARNING, LOG('WorkflowTool.listActions', WARNING,
'Exception while computing worklists: %s' 'Exception while computing worklists: %s'
% grouped_worklist_dict.keys(), % grouped_worklist_dict.keys(),
error=sys.exc_info()) error=True)
continue continue
except ProgrammingError, error_value: except ProgrammingError, error_value:
# 1146 = table does not exist # 1146 = table does not exist
...@@ -715,7 +714,7 @@ def WorkflowTool_refreshWorklistCache(self): ...@@ -715,7 +714,7 @@ def WorkflowTool_refreshWorklistCache(self):
raise raise
LOG('WorkflowTool', WARNING, 'Insertion in worklist cache table ' \ LOG('WorkflowTool', WARNING, 'Insertion in worklist cache table ' \
'failed. Recreating table and retrying.', 'failed. Recreating table and retrying.',
error=sys.exc_info()) error=True)
self.Base_zCreateWorklistTable() self.Base_zCreateWorklistTable()
Base_zInsertIntoWorklistTable(**value_column_dict) Base_zInsertIntoWorklistTable(**value_column_dict)
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import base64, errno, logging, os, select, socket, sys, time import errno, logging, os, socket, time
from threading import Thread from threading import Thread
from UserDict import IterableUserDict from UserDict import IterableUserDict
import Lifetime import Lifetime
...@@ -326,6 +326,6 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase): ...@@ -326,6 +326,6 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
try: try:
portal.portal_activities.process_timer(None, None) portal.portal_activities.process_timer(None, None)
except Exception: except Exception:
LOG('Invoking Activity Tool', ERROR, '', error=sys.exc_info()) LOG('Invoking Activity Tool', ERROR, '', error=True)
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
...@@ -68,12 +68,11 @@ class Git(WorkingCopy): ...@@ -68,12 +68,11 @@ class Git(WorkingCopy):
try: try:
return subprocess.Popen(argv + list(args), **kw) return subprocess.Popen(argv + list(args), **kw)
except OSError, e: except OSError, e:
import sys
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
LOG('Git', WARNING, LOG('Git', WARNING,
'will not work as the executable cannot be executed, perhaps not ' 'will not work as the executable cannot be executed, perhaps not '
'in the Zope PATH or because of permissions.', 'in the Zope PATH or because of permissions.',
error=sys.exc_info()) error=True)
raise GitInstallationError("git command cannot be executed: %s" % \ raise GitInstallationError("git command cannot be executed: %s" % \
e.strerror) e.strerror)
......
...@@ -32,7 +32,6 @@ from Acquisition import Implicit ...@@ -32,7 +32,6 @@ from Acquisition import Implicit
import time import time
import os import os
import sys
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
from MethodObject import Method from MethodObject import Method
...@@ -413,6 +412,6 @@ except ImportError: ...@@ -413,6 +412,6 @@ except ImportError:
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
LOG('Subversion', WARNING, LOG('Subversion', WARNING,
'could not import pysvn; until pysvn is installed properly,' 'could not import pysvn; until pysvn is installed properly,'
' this tool will not work.', error=sys.exc_info()) ' this tool will not work.', error=True)
def newSubversionClient(container, **kw): def newSubversionClient(container, **kw):
raise SubversionInstallationError, 'pysvn library is not installed' raise SubversionInstallationError, 'pysvn library is not installed'
...@@ -31,7 +31,6 @@ from Products.PluggableAuthService.interfaces.plugins import IUserEnumerationPlu ...@@ -31,7 +31,6 @@ from Products.PluggableAuthService.interfaces.plugins import IUserEnumerationPlu
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Security.ERP5UserManager import ERP5UserManager from Products.ERP5Security.ERP5UserManager import ERP5UserManager
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import sys
from DateTime import DateTime from DateTime import DateTime
from zLOG import LOG, PROBLEM from zLOG import LOG, PROBLEM
from AccessControl.AuthEncoding import pw_validate from AccessControl.AuthEncoding import pw_validate
...@@ -241,7 +240,7 @@ class EGOVUserManager(ERP5UserManager): ...@@ -241,7 +240,7 @@ class EGOVUserManager(ERP5UserManager):
except ConflictError: except ConflictError:
raise raise
except: except:
LOG('ERP5Security', PROBLEM, 'getUserByLogin failed', error=sys.exc_info()) LOG('ERP5Security', PROBLEM, 'getUserByLogin failed', error=True)
# Here we must raise an exception to prevent callers from caching # Here we must raise an exception to prevent callers from caching
# a result of a degraded situation. # a result of a degraded situation.
# The kind of exception does not matter as long as it's catched by # The kind of exception does not matter as long as it's catched by
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# #
############################################################################## ##############################################################################
import operator, sys import operator
from cgi import escape from cgi import escape
from itertools import chain, imap, islice from itertools import chain, imap, islice
from urllib import quote from urllib import quote
...@@ -491,7 +491,7 @@ class HBTreeFolder2Base (Persistent): ...@@ -491,7 +491,7 @@ class HBTreeFolder2Base (Persistent):
raise raise
except Exception: except Exception:
LOG('Zope', ERROR, 'manage_beforeDelete() threw', LOG('Zope', ERROR, 'manage_beforeDelete() threw',
error=sys.exc_info()) error=True)
self._delOb(id) self._delOb(id)
......
...@@ -255,7 +255,7 @@ class Localizer(LanguageManager, Folder): ...@@ -255,7 +255,7 @@ class Localizer(LanguageManager, Folder):
def set(self, lang, priority): def set(self, lang, priority):
if lang != self.lang: if lang != self.lang:
LOG('Localizer', PROBLEM, LOG('Localizer', PROBLEM,
'Cannot change language inside a translationContext', error=1) 'Cannot change language inside a translationContext', error=True)
MARKER = [] MARKER = []
from patches import get_request # late import, as this is patched by from patches import get_request # late import, as this is patched by
# unit tests # unit tests
......
...@@ -108,8 +108,6 @@ from DateTime import DateTime ...@@ -108,8 +108,6 @@ from DateTime import DateTime
from zLOG import LOG, ERROR, WARNING from zLOG import LOG, ERROR, WARNING
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import sys
hosed_connection = ( hosed_connection = (
CR.SERVER_GONE_ERROR, CR.SERVER_GONE_ERROR,
CR.SERVER_LOST CR.SERVER_LOST
...@@ -438,7 +436,7 @@ class DB(TM): ...@@ -438,7 +436,7 @@ class DB(TM):
self._query("SELECT GET_LOCK('%s',0)" % self._mysql_lock, allow_reconnect=not self._transactions) self._query("SELECT GET_LOCK('%s',0)" % self._mysql_lock, allow_reconnect=not self._transactions)
except: except:
LOG('ZMySQLDA', ERROR, "exception during _begin", LOG('ZMySQLDA', ERROR, "exception during _begin",
error=sys.exc_info()) error=True)
raise raise
def tpc_vote(self, *ignored): def tpc_vote(self, *ignored):
...@@ -477,7 +475,7 @@ class DB(TM): ...@@ -477,7 +475,7 @@ class DB(TM):
LOG('ZMySQLDA', ERROR, "aborting when non-transactional") LOG('ZMySQLDA', ERROR, "aborting when non-transactional")
except OperationalError, m: except OperationalError, m:
LOG('ZMySQLDA', ERROR, "exception during _abort", LOG('ZMySQLDA', ERROR, "exception during _abort",
error=sys.exc_info()) error=True)
if m[0] not in hosed_connection: if m[0] not in hosed_connection:
raise raise
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
# #
############################################################################## ##############################################################################
import sys
from SearchKey import SearchKey from SearchKey import SearchKey
from Products.ZSQLCatalog.Query.SimpleQuery import SimpleQuery from Products.ZSQLCatalog.Query.SimpleQuery import SimpleQuery
from Products.ZSQLCatalog.Query.ComplexQuery import ComplexQuery from Products.ZSQLCatalog.Query.ComplexQuery import ComplexQuery
...@@ -282,7 +281,7 @@ class DateTimeKey(SearchKey): ...@@ -282,7 +281,7 @@ class DateTimeKey(SearchKey):
else: else:
subquery_list = matchExact(self, group, column, value_list, comparison_operator, logical_operator) subquery_list = matchExact(self, group, column, value_list, comparison_operator, logical_operator)
except DateTimeError: except DateTimeError:
LOG('DateTimeKey', 100, 'Got an exception while generating a query for %r %r.' % (comparison_operator, value_list), error=sys.exc_info()) LOG('DateTimeKey', 100, 'Got an exception while generating a query for %r %r.' % (comparison_operator, value_list), error=True)
else: else:
extend(subquery_list) extend(subquery_list)
return query_list return query_list
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment