[Zope-Checkins] SVN: Zope/branches/tseaver-retire_zpkg/ Sync with
2.9 branch.
Tres Seaver
tseaver at palladion.com
Wed Jul 5 10:53:33 EDT 2006
Log message for revision 68975:
Sync with 2.9 branch.
Changed:
U Zope/branches/tseaver-retire_zpkg/doc/CHANGES.txt
U Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/ImplPython.py
U Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/SecurityInfo.py
U Zope/branches/tseaver-retire_zpkg/lib/python/App/ApplicationManager.py
U Zope/branches/tseaver-retire_zpkg/lib/python/App/Hotfixes.py
U Zope/branches/tseaver-retire_zpkg/lib/python/App/ProductContext.py
U Zope/branches/tseaver-retire_zpkg/lib/python/App/RefreshFuncs.py
U Zope/branches/tseaver-retire_zpkg/lib/python/App/special_dtml.py
U Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Cache.py
U Zope/branches/tseaver-retire_zpkg/lib/python/OFS/ObjectManager.py
U Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Uninstalled.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/BTreeFolder2/BTreeFolder2.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/PageTemplateFile.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/ZopePageTemplate.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/PythonScripts/PythonScript.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/SessionDataManager.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/stresstests/stresstestMultiThread.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/Transience/Transience.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ProgressHandler.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ZCatalog.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Shared/DC/ZRDB/Connection.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Signals/SignalHandler.py
U Zope/branches/tseaver-retire_zpkg/lib/python/TAL/XMLParser.py
U Zope/branches/tseaver-retire_zpkg/lib/python/ZPublisher/BeforeTraverse.py
U Zope/branches/tseaver-retire_zpkg/lib/python/ZServer/datatypes.py
U Zope/branches/tseaver-retire_zpkg/lib/python/Zope2/Startup/zopectl.py
U Zope/branches/tseaver-retire_zpkg/lib/python/tempstorage/TemporaryStorage.py
-=-
Modified: Zope/branches/tseaver-retire_zpkg/doc/CHANGES.txt
===================================================================
--- Zope/branches/tseaver-retire_zpkg/doc/CHANGES.txt 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/doc/CHANGES.txt 2006-07-05 14:53:31 UTC (rev 68975)
@@ -18,6 +18,8 @@
Bugs fixed
+ - Collector #2113: 'zopectl test' often masked Ctrl-C.
+
- OFS Application: Updated deprecation warnings.
Support for '__ac_permissions__' and 'meta_types' will be removed in
Zope 2.11, 'methods' support might remain longer.
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/ImplPython.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/ImplPython.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/ImplPython.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -15,13 +15,15 @@
import os
import string
+import logging
+logger = logging.getLogger('Zope Security Policy')
from Acquisition import aq_base
from Acquisition import aq_parent
from Acquisition import aq_inner
from Acquisition import aq_acquire
from ExtensionClass import Base
-from zLOG import LOG, BLATHER, PROBLEM
+from zLOG.EventLogger import CUSTOM_BLATHER
from zope.interface import implements
# This is used when a permission maps explicitly to no permission. We
@@ -346,8 +348,8 @@
return 1
except TypeError:
# 'roles' isn't a sequence
- LOG('Zope Security Policy', PROBLEM, "'%s' passed as roles"
- " during validation of '%s' is not a sequence." % (
+ logger.warn("'%s' passed as roles"
+ " during validation of '%s' is not a sequence." % (
`roles`, name))
raise
@@ -804,7 +806,7 @@
info.append(s + '.')
text = ' '.join(info)
- LOG('Zope Security Policy', BLATHER, 'Unauthorized: %s' % text)
+ logger.log(CUSTOM_BLATHER, 'Unauthorized: %s' % text)
raise Unauthorized(text)
def getUserRolesInContext(user, context):
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/SecurityInfo.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/SecurityInfo.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/AccessControl/SecurityInfo.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -39,13 +39,13 @@
"""
import sys
+import logging
+logger = logging.getLogger('SecurityInfo')
import Acquisition
from AccessControl.ImplPython import _what_not_even_god_should_do
-from zLOG import LOG, WARNING
-
# Security constants - these are imported into the AccessControl
# namespace and can be referenced as AccessControl.PUBLIC etc.
@@ -69,8 +69,8 @@
def _setaccess(self, names, access):
for name in names:
if self.names.get(name, access) != access:
- LOG('SecurityInfo', WARNING, 'Conflicting security '
- 'declarations for "%s"' % name)
+ logger.warn('Conflicting security declarations for "%s"'
+ % name)
self._warnings = 1
self.names[name] = access
@@ -111,8 +111,8 @@
for role in roles:
rdict[role] = 1
if self.roles.get(permission_name, rdict) != rdict:
- LOG('SecurityInfo', WARNING, 'Conflicting default role'
- 'declarations for permission "%s"' % permission_name)
+ logger.warn('Conflicting default role '
+ 'declarations for permission "%s"' % permission_name)
self._warnings = 1
self.roles[permission_name] = rdict
@@ -193,8 +193,8 @@
access)
if getattr(self, '_warnings', None):
- LOG('SecurityInfo', WARNING, 'Class "%s" had conflicting '
- 'security declarations' % classobj.__name__)
+ logger.warn('Class "%s" had conflicting security declarations'
+ % classobj.__name__)
class ClassSecurityInformation(ClassSecurityInfo):
# Default policy is disallow
@@ -273,8 +273,8 @@
dict['__allow_access_to_unprotected_subobjects__'] = self
if getattr(self, '_warnings', None):
- LOG('SecurityInfo', WARNING, 'Module "%s" had conflicting '
- 'security declarations' % dict['__name__'])
+ logger.warn('Module "%s" had conflicting security declarations'
+ % dict['__name__'])
declareProtected__roles__=ACCESS_PRIVATE
def declareProtected(self, permission_name, *names):
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/App/ApplicationManager.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/App/ApplicationManager.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/App/ApplicationManager.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -15,6 +15,9 @@
__version__='$Revision: 1.94 $'[11:-2]
import sys,os,time,Globals, Acquisition, os, Undo
+import logging
+logger = logging.getLogger('ApplicationManager')
+
from Globals import DTMLFile
from OFS.ObjectManager import ObjectManager
from OFS.Folder import Folder
@@ -31,7 +34,6 @@
from zExceptions import Redirect
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from cgi import escape
-import zLOG
import Lifetime
try: import thread
@@ -391,8 +393,7 @@
user = '"%s"' % getSecurityManager().getUser().getUserName()
except:
user = 'unknown user'
- zLOG.LOG("ApplicationManager", zLOG.INFO,
- "Restart requested by %s" % user)
+ logger.info("Restart requested by %s" % user)
#for db in Globals.opened: db.close()
Lifetime.shutdown(1)
return """<html>
@@ -407,8 +408,7 @@
user = '"%s"' % getSecurityManager().getUser().getUserName()
except:
user = 'unknown user'
- zLOG.LOG("ApplicationManager", zLOG.INFO,
- "Shutdown requested by %s" % user)
+ logger.info("Shutdown requested by %s" % user)
#for db in Globals.opened: db.close()
Lifetime.shutdown(0)
return """<html>
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/App/Hotfixes.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/App/Hotfixes.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/App/Hotfixes.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -11,8 +11,10 @@
#
##############################################################################
+import logging
+logger = logging.getLogger('Hotfixes')
+
from version_txt import getZopeVersion
-from zLOG import LOG, INFO, WARNING
merged_hotfixes = {
'Hotfix_2001-09-28': 1,
@@ -33,13 +35,13 @@
def logHotfix(id, apply_hotfix):
if apply_hotfix:
- LOG('Hotfixes', INFO, 'Applying %s' % id)
+ logger.info('Applying %s' % id)
elif apply_hotfix is OUTDATED_ZOPE:
- LOG('Hotfixes', WARNING, 'Not applying %s. It is not designed for '
+ logger.warn('Not applying %s. It is not designed for '
'this version of Zope. Please uninstall the hotfix product.'
% id)
else: # ALREADY_MERGED
- LOG('Hotfixes', WARNING, 'Not applying %s. The fix has already been '
+ logger.warn('Not applying %s. The fix has already been '
'merged into Zope. Please uninstall the hotfix product.'
% id)
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/App/ProductContext.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/App/ProductContext.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/App/ProductContext.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -17,6 +17,8 @@
import os.path, re
import stat
+import logging
+logger = logging.getLogger('Zope')
from AccessControl.PermissionRole import PermissionRole
import Globals, os, OFS.ObjectManager, OFS.misc_, Products
@@ -25,7 +27,6 @@
from HelpSys import HelpTopic, APIHelpTopic
from HelpSys.HelpSys import ProductHelp
from FactoryDispatcher import FactoryDispatcher
-from zLOG import LOG, WARNING
from DateTime import DateTime
from Interface.Implements import instancesOfObjectImplements
from zope.interface import implementedBy
@@ -312,7 +313,7 @@
try:
dir_mod_time=DateTime(os.stat(path)[stat.ST_MTIME])
except OSError, (errno, text):
- LOG("Zope", WARNING, '%s: %s' % (text, path))
+ logger.warn('%s: %s' % (text, path))
return
# test to see if nothing has changed since last registration
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/App/RefreshFuncs.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/App/RefreshFuncs.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/App/RefreshFuncs.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -17,11 +17,14 @@
import os, sys
from time import time
+from traceback import format_exception
+import logging
+logger = logging.getLogger('Refresh')
+
import transaction
import Products
from ExtensionClass import Base
from Globals import PersistentMapping
-from zLOG import format_exception, LOG, ERROR, INFO
global_classes_timestamp = 0
products_mod_times = {}
@@ -136,8 +139,8 @@
def logBadRefresh(productid):
exc = sys.exc_info()
try:
- LOG('Refresh', ERROR, 'Exception while refreshing %s'
- % productid, error=exc)
+ logger.error('Exception while refreshing %s'
+ % productid, error=exc)
if hasattr(exc[0], '__name__'):
error_type = exc[0].__name__
else:
@@ -179,7 +182,7 @@
def performSafeRefresh(jar, productid):
try:
- LOG('Refresh', INFO, 'Refreshing product %s' % productid)
+ logger.info('Refreshing product %s' % productid)
if not performRefresh(jar, productid):
return 0
except:
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/App/special_dtml.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/App/special_dtml.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/App/special_dtml.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -10,10 +10,11 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
+from types import InstanceType
+import logging
+logger = logging.getLogger('ZPublisher')
import DocumentTemplate, Common, Persistence, MethodObject, Globals, os, sys
-from types import InstanceType
-from zLOG import LOG,WARNING
from App.config import getConfiguration
class HTML(DocumentTemplate.HTML,Persistence.Persistent,):
@@ -175,8 +176,10 @@
try: result = render_blocks(self._v_blocks, ns)
except DTReturn, v: result = v.v
except AttributeError:
- if type(sys.exc_value)==InstanceType and sys.exc_value.args[0]=="_v_blocks":
- LOG("ZPublisher",WARNING,"DTML file '%s' could not be read" % self.raw)
+ if (type(sys.exc_value) == InstanceType
+ and sys.exc_value.args[0]=="_v_blocks"):
+ logger.warn("DTML file '%s' could not be read"
+ % self.raw)
raise ValueError, ("DTML file error: "
"Check logfile for details")
else:
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Cache.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Cache.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Cache.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -15,10 +15,12 @@
$Id$
"""
import time, sys
+import logging
+logger = logging.getLogger('Cache')
+
import Globals
from Globals import DTMLFile
from Acquisition import aq_get, aq_acquire, aq_inner, aq_parent, aq_base
-from zLOG import LOG, WARNING
from AccessControl import getSecurityManager
from AccessControl.Role import _isBeingUsedAsAMethod
from AccessControl import Unauthorized
@@ -195,8 +197,7 @@
mtime_func, default)
return val
except:
- LOG('Cache', WARNING, 'ZCache_get() exception',
- error=sys.exc_info())
+ logger.warn('ZCache_get() exception', error=sys.exc_info())
return default
return default
@@ -213,8 +214,7 @@
c.ZCache_set(ob, data, view_name, keywords,
mtime_func)
except:
- LOG('Cache', WARNING, 'ZCache_set() exception',
- error=sys.exc_info())
+ logger.warn('ZCache_set() exception', error=sys.exc_info())
def ZCacheable_invalidate(self, view_name='', REQUEST=None):
'''Called after a cacheable object is edited. Causes all
@@ -231,8 +231,7 @@
except:
exc = sys.exc_info()
try:
- LOG('Cache', WARNING, 'ZCache_invalidate() exception',
- error=exc)
+ logger.warn('ZCache_invalidate() exception', error=exc)
message = 'An exception occurred: %s: %s' % exc[:2]
finally:
exc = None
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/OFS/ObjectManager.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/OFS/ObjectManager.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/OFS/ObjectManager.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -20,6 +20,8 @@
import sys, fnmatch, copy, os, re
from cgi import escape
from cStringIO import StringIO
+import logging
+logger = logging.getLogger('FTP')
from types import StringType, UnicodeType
import App.Common
@@ -36,7 +38,6 @@
from webdav.Lockable import ResourceLockedError
from webdav.NullResource import NullResource
from zExceptions import BadRequest
-from zLOG import LOG, ERROR
from ZODB.POSException import ConflictError
from zope.interface import implements
@@ -673,8 +674,8 @@
try:
stat=marshal.loads(v.manage_FTPstat(REQUEST))
except:
- LOG("FTP", ERROR, "Failed to stat file '%s'" % k,
- error=sys.exc_info())
+ logger.error("Failed to stat file '%s'" % k,
+ error=sys.exc_info())
stat=None
if stat is not None:
out=out+((k,stat),)
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Uninstalled.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Uninstalled.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/OFS/Uninstalled.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -13,11 +13,13 @@
"""
Objects for packages that have been uninstalled.
"""
-import SimpleItem, Globals, Acquisition
+from thread import allocate_lock
+import logging
+logger = logging.getLogger('ZODB') # ???
+
+import SimpleItem, Globals, Acquisition
from Acquisition import Acquired
import Persistence
-from thread import allocate_lock
-from zLOG import LOG, WARNING
from cgi import escape
broken_klasses={}
@@ -71,8 +73,9 @@
klass.info=(
'This object\'s class was %s in module %s.' %
(klass.__name__, klass.__module__))
- LOG('ZODB', WARNING, 'Could not import class %s '
- 'from module %s' % (`klass.__name__`, `klass.__module__`))
+ logger.warn('Could not import class %s '
+ 'from module %s'
+ % (`klass.__name__`, `klass.__module__`))
finally:
broken_klasses_lock.release()
if oid is None: return klass
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/BTreeFolder2/BTreeFolder2.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/BTreeFolder2/BTreeFolder2.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -17,6 +17,7 @@
"""
import sys
+import logging
from cgi import escape
from urllib import quote
from random import randint
@@ -35,7 +36,6 @@
from AccessControl import getSecurityManager, ClassSecurityInfo
from AccessControl.Permissions import access_contents_information, \
view_management_screens
-from zLOG import LOG, INFO, ERROR, WARNING
from Products.ZCatalog.Lazy import LazyMap
from zope.event import notify
from zope.app.container.contained import ObjectAddedEvent
@@ -45,6 +45,7 @@
from OFS.event import ObjectWillBeRemovedEvent
import OFS.subscribers
+LOG = logging.getLogger('BTreeFolder2')
manage_addBTreeFolderForm = DTMLFile('folderAdd', globals())
@@ -191,8 +192,7 @@
% repr(key))
return 1
except AssertionError:
- LOG('BTreeFolder2', WARNING,
- 'Detected damage to %s. Fixing now.' % path,
+ LOG.warn( 'Detected damage to %s. Fixing now.' % path,
error=sys.exc_info())
try:
self._tree = OOBTree(self._tree)
@@ -201,11 +201,11 @@
mt_index[key] = OIBTree(value)
self._mt_index = mt_index
except:
- LOG('BTreeFolder2', ERROR, 'Failed to fix %s.' % path,
+ LOG.error('Failed to fix %s.' % path,
error=sys.exc_info())
raise
else:
- LOG('BTreeFolder2', INFO, 'Fixed %s.' % path)
+ LOG.info('Fixed %s.' % path)
return 0
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/PageTemplateFile.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/PageTemplateFile.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/PageTemplateFile.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -18,8 +18,9 @@
__version__ = '$Revision: 1.30 $'[11:-2]
import os, AccessControl
+import logging
+
from Globals import package_home, DevelopmentMode
-from zLOG import LOG, ERROR
from Shared.DC.Scripts.Script import Script
from Shared.DC.Scripts.Signature import FuncCode
from AccessControl import getSecurityManager
@@ -31,6 +32,8 @@
from App.config import getConfiguration
from OFS.SimpleItem import Item_w__name__
+LOG = logging.getLogger('PageTemplateFile')
+
class PageTemplateFile(Item_w__name__, Script, PageTemplate, Traversable):
"Zope wrapper for filesystem Page Template using TAL, TALES, and METAL"
@@ -146,8 +149,7 @@
self.pt_edit(text, t)
self._cook()
if self._v_errors:
- LOG('PageTemplateFile', ERROR, 'Error in template',
- '\n'.join(self._v_errors))
+ LOG.error('Error in template', '\n'.join(self._v_errors))
return
self._v_last_read = mtime
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -20,7 +20,6 @@
import os, AccessControl, Acquisition, sys, types
from types import StringType
from Globals import DTMLFile, ImageFile, MessageDialog, package_home
-from zLOG import LOG, ERROR, INFO
from OFS.SimpleItem import SimpleItem
from DateTime.DateTime import DateTime
from Shared.DC.Scripts.Script import Script, BindingsUI
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/DateIndex/DateIndex.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -18,6 +18,8 @@
import time
from datetime import date, datetime
from datetime import tzinfo, timedelta
+import logging
+logger = logging.getLogger('UnIndex')
from types import StringType, FloatType, IntType
import BTrees.Length
@@ -28,7 +30,6 @@
from Globals import DTMLFile
from OFS.PropertyManager import PropertyManager
from ZODB.POSException import ConflictError
-from zLOG import LOG, ERROR
from zope.interface import implements
from Products.PluginIndexes.common import safe_callable
@@ -144,7 +145,7 @@
except ConflictError:
raise
except:
- LOG('UnIndex', ERROR,
+ logger.error(
("Should not happen: ConvertedDate was there,"
" now it's not, for document with id %s" %
documentId))
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -18,10 +18,11 @@
import operator, warnings
import re
from cgi import escape
+import logging
+logger = logging.getLogger('TextIndex')
from types import *
from Globals import Persistent, DTMLFile
-from zLOG import LOG, ERROR
from Acquisition import Implicit
from OFS.SimpleItem import SimpleItem
from BTrees.IOBTree import IOBTree
@@ -376,9 +377,8 @@
for wid in wids:
widScores = get(wid, None)
if widScores is None:
- LOG('TextIndex', ERROR,
- 'unindex_object tried to unindex nonexistent'
- ' document, wid %s, %s' % (i,wid))
+ logger.error('unindex_object tried to unindex nonexistent'
+ ' document, wid %s, %s' % (i,wid))
continue
if type(widScores) is TupleType:
del index[wid]
@@ -394,9 +394,8 @@
else:
del index[wid]
except (KeyError, IndexError, TypeError):
- LOG('TextIndex', ERROR,
- 'unindex_object tried to unindex nonexistent'
- ' document %s' % str(i))
+ logger.error('unindex_object tried to unindex nonexistent'
+ ' document %s' % str(i))
def __getitem__(self, word):
"""Return an InvertedIndex-style result "list"
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/PythonScripts/PythonScript.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/PythonScripts/PythonScript.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/PythonScripts/PythonScript.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -20,6 +20,7 @@
__version__='$Revision: 1.56 $'[11:-2]
import sys, os, traceback, re, marshal, new
+import logging
from Globals import DTMLFile, MessageDialog, package_home
import AccessControl, OFS, RestrictedPython
from Acquisition import aq_parent
@@ -33,10 +34,11 @@
from OFS.History import Historical, html_diff
from OFS.Cache import Cacheable
from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
-from zLOG import LOG, ERROR, INFO, PROBLEM
from zExceptions import Forbidden
import Globals
+LOG = logging.getLogger('Script (Python)')
+
# Track the Python bytecode version
import imp
Python_magic = imp.get_magic()
@@ -209,7 +211,7 @@
getattr(self, 'Script_magic', None) != Script_magic):
global _log_complaint
if _log_complaint:
- LOG(self.meta_type, INFO, _log_complaint)
+ LOG.info(_log_complaint)
_log_complaint = 0
# Changes here won't get saved, unless this Script is edited.
body = self._body.rstrip()
@@ -438,7 +440,7 @@
else:
self._makeFunction()
except:
- LOG(self.meta_type, ERROR, 'write failed', error=sys.exc_info())
+ LOG.error('write failed', error=sys.exc_info())
raise
def manage_FTPget(self):
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/SessionDataManager.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/SessionDataManager.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/SessionDataManager.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -12,6 +12,9 @@
############################################################################
import re, time, sys
+import logging
+logger = logging.getLogger('Session Tracking')
+
import Globals
from OFS.SimpleItem import Item
from Acquisition import Implicit, Explicit, aq_base
@@ -19,7 +22,7 @@
from AccessControl.Owned import Owned
from AccessControl.Role import RoleManager
from App.Management import Tabs
-from zLOG import LOG, WARNING, BLATHER
+from zLOG.EventLogger import CUSTOM_BLATHER
from AccessControl import ClassSecurityInfo
import SessionInterfaces
from SessionPermissions import *
@@ -205,7 +208,7 @@
transactions for mounted storages. """
if self.obpath is None:
err = 'Session data container is unspecified in %s' % self.getId()
- LOG('Session Tracking', WARNING, err)
+ logger.warn(err)
raise SessionIdManagerErr, err
try:
# This should arguably use restrictedTraverse, but it
@@ -215,7 +218,7 @@
# hasattr hides conflicts
if DEBUG and not getattr(self, '_v_wrote_dc_type', None):
args = '/'.join(self.obpath)
- LOG('Session Tracking', BLATHER,
+ logger.log(CUSTOM_BLATHER,
'External data container at %s in use' % args)
self._v_wrote_dc_type = 1
return self.unrestrictedTraverse(self.obpath)
@@ -281,7 +284,7 @@
getSessionData = sdm.getSessionData
except:
msg = 'Session automatic traversal failed to get session data'
- LOG('Session Tracking', WARNING, msg, error=sys.exc_info())
+ logger.warn(msg, error=sys.exc_info())
return
# set the getSessionData method in the "lazy" namespace
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/stresstests/stresstestMultiThread.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/stresstests/stresstestMultiThread.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/Sessions/stresstests/stresstestMultiThread.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -41,7 +41,7 @@
from OFS.Folder import Folder
import sys
import traceback
-from zLOG import log_time
+from zLOG.EventLogger import log_time
sys.setcheckinterval(200)
from Products.Transience.tests import fauxtime
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/Transience/Transience.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/Transience/Transience.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/Transience/Transience.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -22,6 +22,7 @@
import sys
import os
import thread
+import logging
from cgi import escape
import Globals
@@ -40,8 +41,8 @@
from AccessControl.SecurityManagement import newSecurityManager, \
setSecurityManager
from AccessControl.User import nobody
-from zLOG import LOG, WARNING, INFO
+
from TransientObject import TransientObject
from Fake import FakeIOBTree
@@ -60,6 +61,8 @@
_marker = []
+LOG = logging.getLogger('Transience')
+
def setStrict(on=''):
""" Turn on assertions (which may cause conflicts) """
global STRICT
@@ -72,7 +75,7 @@
for arg in args:
sargs.append(str(arg))
msg = ' '.join(sargs)
- LOG('Transience', INFO, msg)
+ LOG.info(msg)
constructTransientObjectContainerForm = HTMLFile(
'dtml/addTransientObjectContainer', globals())
@@ -434,7 +437,7 @@
length = self._length() # XXX ReadConflictError hotspot
if self._limit and length >= self._limit:
- LOG('Transience', WARNING,
+ LOG.warning(
('Transient object container %s max subobjects '
'reached' % self.getId())
)
@@ -796,8 +799,7 @@
except (KeyError, AttributeError):
path = self.getPhysicalPath()
err = 'No such onAdd/onDelete method %s referenced via %s'
- LOG('Transience',
- WARNING,
+ LOG.warning(
err % (callback, '/'.join(path)),
error=sys.exc_info()
)
@@ -817,8 +819,7 @@
except:
# dont raise, just log
path = self.getPhysicalPath()
- LOG('Transience',
- WARNING,
+ LOG.warning(
'%s failed when calling %s in %s' % (name,callback,
'/'.join(path)),
error=sys.exc_info()
@@ -828,8 +829,7 @@
else:
err = '%s in %s attempted to call non-callable %s'
path = self.getPhysicalPath()
- LOG('Transience',
- WARNING,
+ LOG.warning(
err % (name, '/'.join(path), callback),
error=sys.exc_info()
)
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ProgressHandler.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ProgressHandler.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ProgressHandler.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -15,7 +15,7 @@
"""
import time, sys
-from zLOG import LOG, INFO
+import logging
from DateTime.DateTime import DateTime
@@ -92,7 +92,8 @@
__implements__ = IProgressHandler
def output(self, text):
- LOG(self._ident, INFO, text)
+ logger = logging.getLogger(self._ident)
+ logger.info(text)
class FilelogHandler(StdoutHandler):
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ZCatalog.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Products/ZCatalog/ZCatalog.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -37,7 +37,6 @@
import PluggableIndexInterface
from Products.PluginIndexes.interfaces import IPluggableIndex
from Products.PluginIndexes.TextIndex import Splitter
-from zLOG import LOG
from zope.interface import implements
from Catalog import Catalog, CatalogError
@@ -47,8 +46,11 @@
from ZCatalogIndexes import ZCatalogIndexes
-LOG = logging.getLogger('Zope.ZCatalog')
+logger = logging.getLogger('Zope.ZCatalog')
+# BBB: some products apparently import 'LOG' from here! Gone in 2.10.
+from zLOG import LOG
+
manage_addZCatalogForm=DTMLFile('dtml/addZCatalog',globals())
def manage_addZCatalog(self, id, title,
@@ -304,8 +306,8 @@
except ConflictError:
raise
except:
- LOG.error('Recataloging object at %s failed' % p,
- exc_info=sys.exc_info())
+ logger.error('Recataloging object at %s failed' % p,
+ exc_info=sys.exc_info())
if pghandler: pghandler.finish()
@@ -494,8 +496,8 @@
if obj is None:
obj = self.resolve_url(p, REQUEST)
if obj is None:
- LOG.error('reindexIndex could not resolve '
- 'an object from the uid %r.' % p)
+ logger.error('reindexIndex could not resolve '
+ 'an object from the uid %r.' % p)
else:
# don't update metadata when only reindexing a single
# index via the UI
@@ -924,7 +926,7 @@
classes.
"""
- LOG.info('Start migration of indexes for %s' % self.absolute_url(1))
+ logger.info('Start migration of indexes for %s' % self.absolute_url(1))
for idx in self.Indexes.objectValues():
bases = [str(name) for name in idx.__class__.__bases__]
@@ -941,7 +943,7 @@
if found:
idx_type = idx.meta_type
idx_id = idx.getId()
- LOG.info('processing index %s' % idx_id)
+ logger.info('processing index %s' % idx_id)
indexed_attrs = getattr(idx, 'indexed_attrs', None)
@@ -963,7 +965,8 @@
self.manage_reindexIndex(idx_id, REQUEST)
self._migrated_280 = True
- LOG.info('Finished migration of indexes for %s' % self.absolute_url(1))
+ logger.info('Finished migration of indexes for %s'
+ % self.absolute_url(1))
if RESPONSE:
RESPONSE.redirect( URL1 +
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Shared/DC/ZRDB/Connection.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Shared/DC/ZRDB/Connection.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Shared/DC/ZRDB/Connection.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -15,6 +15,9 @@
$Id$'''
__version__='$Revision: 1.39 $'[11:-2]
+import logging
+logger = logging.getLogger('Shared.DC.ZRDB.Connection')
+
import Globals, OFS.SimpleItem, AccessControl.Role, Acquisition, sys
from DateTime import DateTime
from App.Dialogs import MessageDialog
@@ -24,7 +27,6 @@
from cStringIO import StringIO
from Results import Results
from sys import exc_info
-from zLOG import LOG, ERROR
from cgi import escape
import DocumentTemplate, RDB
from zExceptions import BadRequest
@@ -68,10 +70,8 @@
if self.connection_string:
try: self.connect(self.connection_string)
except:
- LOG('Shared.DC.ZRDB.Connection',
- ERROR,
- 'Error connecting to relational database.',
- error=exc_info())
+ logger.error('Error connecting to relational database.',
+ error=exc_info())
def title_and_id(self):
s=Connection.inheritedAttribute('title_and_id')(self)
@@ -150,10 +150,8 @@
if hasattr(self,'_v_database_connection'):
self._v_database_connection.close()
except:
- LOG('Shared.DC.ZRDB.Connection',
- ERROR,
- 'Error closing relational database connection.',
- error=exc_info())
+ logger.error('Error closing relational database connection.',
+ error=exc_info())
self._v_connected=''
if REQUEST is not None:
return self.manage_main(self, REQUEST)
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Signals/SignalHandler.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Signals/SignalHandler.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Signals/SignalHandler.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -16,8 +16,11 @@
__version__='$Revision: 1.2 $'[11:-2]
import sys, os
-import signal, zLOG
+import signal
+import logging
+LOG = logging.getLogger('Signals')
+
class SignalHandler:
def __init__(self):
@@ -36,9 +39,8 @@
items = self.registry[signum] = []
signal.signal(signum, self.signalHandler)
signame = get_signal_name(signum)
- zLOG.LOG('Z2', zLOG.BLATHER, "Installed sighandler for %s" % (
- signame
- ))
+ LOG.debug("Installed sighandler for %s" % signame)
+
items.insert(0, handler)
def getRegisteredSignals(self):
@@ -49,7 +51,7 @@
def signalHandler(self, signum, frame):
"""Meta signal handler that dispatches to registered handlers."""
signame = get_signal_name(signum)
- zLOG.LOG('Z2', zLOG.INFO , "Caught signal %s" % signame)
+ LOG.info("Caught signal %s" % signame)
for handler in self.registry.get(signum, []):
# Never let a bad handler prevent the standard signal
@@ -59,9 +61,7 @@
# if we trap SystemExit, we can't restart
raise
except:
- zLOG.LOG('Z2', zLOG.WARNING,
- 'A handler for %s failed!' % signame,
- error=sys.exc_info())
+ LOG.warn('A handler for %s failed!' % signame, exc_info=sys.exc_info())
_signals = None
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/TAL/XMLParser.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/TAL/XMLParser.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/TAL/XMLParser.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -16,10 +16,9 @@
"""
import xml.parsers.expat
+import logging
+logger = logging.getLogger('TAL.XMLParser')
-import zLOG
-
-
XMLParseError = xml.parsers.expat.ExpatError
@@ -56,8 +55,7 @@
try:
self.parser.ordered_attributes = self.ordered_attributes
except AttributeError:
- zLOG.LOG("TAL.XMLParser", zLOG.INFO,
- "Can't set ordered_attributes")
+ logger.info("Can't set ordered_attributes")
self.ordered_attributes = 0
for name in self.handler_names:
method = getattr(self, name, None)
@@ -65,8 +63,7 @@
try:
setattr(p, name, method)
except AttributeError:
- zLOG.LOG("TAL.XMLParser", zLOG.PROBLEM,
- "Can't set expat handler %s" % name)
+ logger.warn("Can't set expat handler %s" % name)
def createParser(self, encoding=None):
return xml.parsers.expat.ParserCreate(encoding, ' ')
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/ZPublisher/BeforeTraverse.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/ZPublisher/BeforeTraverse.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/ZPublisher/BeforeTraverse.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -13,9 +13,9 @@
__version__='$Revision: 1.12 $'[11:-2]
"""BeforeTraverse interface and helper classes"""
+import logging
from Acquisition import aq_base
-from zLOG import LOG, ERROR
import sys
# Interface
@@ -86,6 +86,7 @@
MultiHook calls the named hook from the class of the container, then
the prior hook, then all the hooks in its list.
"""
+ logger = logging.getLogger('MultiHook')
def __init__(self, hookname, prior, defined_in_class):
self._hookname = hookname
self._prior = prior
@@ -103,7 +104,7 @@
try:
cob(container, request)
except TypeError:
- LOG('MultiHook', ERROR, '%s call %s failed.' % (
+ self.logger.error('%s call %s failed.' % (
`self._hookname`, `cob`), error=sys.exc_info())
def add(self, cob):
@@ -120,6 +121,7 @@
>>> registerBeforeTraverse(folder, NameCaller('preop'), 'XApp')
"""
+ logger = logging.getLogger('BeforeTraverse')
def __init__(self, name):
self.name = name
@@ -149,8 +151,6 @@
# Only catch exceptions that are likely to be logic errors.
# We shouldn't catch Redirects, Unauthorizeds, etc. since
# the programmer may want to raise them deliberately.
- from zLOG import LOG, ERROR
import sys
- LOG('BeforeTraverse', ERROR,
- 'Error while invoking hook: "%s"' % self.name, error=
- sys.exc_info())
+ self.logger.error('Error while invoking hook: "%s"'
+ % self.name, error=sys.exc_info())
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/ZServer/datatypes.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/ZServer/datatypes.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/ZServer/datatypes.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -170,8 +170,9 @@
if password is None:
msg = ('Monitor server not started because no emergency user '
'exists.')
- import zLOG
- zLOG.LOG("Zope", zLOG.ERROR, msg)
+ import logging
+ logger = logging.getLogger('Zope')
+ logger.error(msg)
return
from ZServer.medusa.monitor import secure_monitor_server
return secure_monitor_server(hostname=self.host, port=self.port,
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/Zope2/Startup/zopectl.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/Zope2/Startup/zopectl.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/Zope2/Startup/zopectl.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -258,14 +258,20 @@
pid = os.fork()
if pid == 0: # child
os.execv(self.options.python, args)
- else:
- os.waitpid(pid, 0)
+
+ # Parent process running (execv replaces process in child
+ while True:
+ try:
+ os.waitpid(pid, 0)
+ except (OSError, KeyboardInterrupt):
+ continue
+ else:
+ break
def help_test(self):
print "test [args]+ -- run unit / functional tests."
print " See $ZOPE_HOME/bin/test.py --help for syntax."
-
def main(args=None):
# This is exactly like zdctl.main(), but uses ZopeCtlOptions and
# ZopeCmd instead of ZDCtlOptions and ZDCmd, so the default values
Modified: Zope/branches/tseaver-retire_zpkg/lib/python/tempstorage/TemporaryStorage.py
===================================================================
--- Zope/branches/tseaver-retire_zpkg/lib/python/tempstorage/TemporaryStorage.py 2006-07-05 14:40:45 UTC (rev 68974)
+++ Zope/branches/tseaver-retire_zpkg/lib/python/tempstorage/TemporaryStorage.py 2006-07-05 14:53:31 UTC (rev 68975)
@@ -21,8 +21,10 @@
"""
__version__ ='$Revision: 1.1.2.2 $'[11:-2]
+import logging
+logger = logging.getLogger('TemporaryStorage')
-from zLOG import LOG, BLATHER
+from zLOG.EventLogger import CUSTOM_BLATHER
from ZODB.serialize import referencesf
from ZODB import POSException
from ZODB.BaseStorage import BaseStorage
@@ -182,7 +184,7 @@
if version:
# we allow a version to be in use although we don't
# support versions in the storage.
- LOG('TemporaryStorage', BLATHER,
+ logging.log(CUSTOM_BLATHER,
('versions in use with TemporaryStorage although Temporary'
'Storage doesnt support versions'),
)
More information about the Zope-Checkins
mailing list