[Zope3-checkins] SVN: Zope3/trunk/ Fixed issue 536: ErrorLogUtility has UnboundLocalError

Dmitry Vasiliev dima at hlabs.spb.ru
Thu Feb 2 07:36:28 EST 2006


Log message for revision 41540:
  Fixed issue 536: ErrorLogUtility has UnboundLocalError
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/error/error.py
  U   Zope3/trunk/src/zope/app/error/tests.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2006-02-02 11:21:48 UTC (rev 41539)
+++ Zope3/trunk/doc/CHANGES.txt	2006-02-02 12:36:28 UTC (rev 41540)
@@ -35,6 +35,8 @@
 
     Bug Fixes
 
+      - Fixed issue 536: ErrorLogUtility has UnboundLocalError.
+
       - zope.i18n.interpolate:
 
         + now if the variable wasn't found in the mapping no substitution

Modified: Zope3/trunk/src/zope/app/error/error.py
===================================================================
--- Zope3/trunk/src/zope/app/error/error.py	2006-02-02 11:21:48 UTC (rev 41539)
+++ Zope3/trunk/src/zope/app/error/error.py	2006-02-02 12:36:28 UTC (rev 41540)
@@ -33,6 +33,7 @@
 from zope.app.error.interfaces import IErrorReportingUtility
 from zope.app.error.interfaces import ILocalErrorReportingUtility
 
+
 #Restrict the rate at which errors are sent to the Event Log
 _rate_restrict_pool = {}
 
@@ -50,7 +51,7 @@
 
 cleanup_lock = allocate_lock()
 
-log = logging.getLogger('SiteError')
+logger = logging.getLogger('SiteError')
 
 class ErrorReportingUtility(Persistent, Contained):
     """Error Reporting Utility"""
@@ -130,7 +131,7 @@
             # We'll ignore these errors, and print something
             # useful instead, but also log the error.
             except:
-                log.exception(
+                logger.exception(
                     'Error in ErrorReportingUtility while getting a str '
                     'representation of an object')
                 strv = '<unprintable %s object>' % (
@@ -175,7 +176,7 @@
             try:
                 raise info[0], info[1], info[2]
             except:
-                log.exception(str(url))
+                logger.exception(str(url))
 
     def getProperties(self):
         return {

Modified: Zope3/trunk/src/zope/app/error/tests.py
===================================================================
--- Zope3/trunk/src/zope/app/error/tests.py	2006-02-02 11:21:48 UTC (rev 41539)
+++ Zope3/trunk/src/zope/app/error/tests.py	2006-02-02 12:36:28 UTC (rev 41540)
@@ -24,12 +24,17 @@
 
 from zope.app.error.error import ErrorReportingUtility
 
+class Error(Exception):
 
+    def __str__(self):
+        return u"Error (\u0410)"
+
 class C1(object):
+
     def getAnErrorInfo(self):
         exc_info = None
         try:
-            someerror()
+            raise Error()
         except:
             exc_info = sys.exc_info()
         return exc_info



More information about the Zope3-Checkins mailing list