Commit 2e062e44 authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

parent 59a14865
...@@ -18,8 +18,8 @@ Zope object encapsulating a Page Template from the filesystem. ...@@ -18,8 +18,8 @@ Zope object encapsulating a Page Template from the filesystem.
__version__ = '$Revision: 1.30 $'[11:-2] __version__ = '$Revision: 1.30 $'[11:-2]
import os, AccessControl import os, AccessControl
from logging import getLogger
from Globals import package_home, DevelopmentMode from Globals import package_home, DevelopmentMode
from zLOG import LOG, ERROR
from Shared.DC.Scripts.Script import Script from Shared.DC.Scripts.Script import Script
from Shared.DC.Scripts.Signature import FuncCode from Shared.DC.Scripts.Signature import FuncCode
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
...@@ -31,6 +31,9 @@ from Acquisition import aq_parent, aq_inner ...@@ -31,6 +31,9 @@ from Acquisition import aq_parent, aq_inner
from App.config import getConfiguration from App.config import getConfiguration
from OFS.SimpleItem import Item_w__name__ from OFS.SimpleItem import Item_w__name__
LOG = getLogger('PageTemplateFile')
class PageTemplateFile(Item_w__name__, Script, PageTemplate, Traversable): class PageTemplateFile(Item_w__name__, Script, PageTemplate, Traversable):
"Zope wrapper for filesystem Page Template using TAL, TALES, and METAL" "Zope wrapper for filesystem Page Template using TAL, TALES, and METAL"
...@@ -146,8 +149,7 @@ class PageTemplateFile(Item_w__name__, Script, PageTemplate, Traversable): ...@@ -146,8 +149,7 @@ class PageTemplateFile(Item_w__name__, Script, PageTemplate, Traversable):
self.pt_edit(text, t) self.pt_edit(text, t)
self._cook() self._cook()
if self._v_errors: if self._v_errors:
LOG('PageTemplateFile', ERROR, 'Error in template', LOG.error('Error in template %s' % '\n'.join(self._v_errors))
'\n'.join(self._v_errors))
return return
self._v_last_read = mtime self._v_last_read = mtime
......
...@@ -20,7 +20,6 @@ __version__='$Revision: 1.48 $'[11:-2] ...@@ -20,7 +20,6 @@ __version__='$Revision: 1.48 $'[11:-2]
import os, AccessControl, Acquisition, sys, types import os, AccessControl, Acquisition, sys, types
from types import StringType from types import StringType
from Globals import DTMLFile, ImageFile, MessageDialog, package_home from Globals import DTMLFile, ImageFile, MessageDialog, package_home
from zLOG import LOG, ERROR, INFO
from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import SimpleItem
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
from Shared.DC.Scripts.Script import Script, BindingsUI from Shared.DC.Scripts.Script import Script, BindingsUI
...@@ -38,14 +37,7 @@ from PageTemplate import PageTemplate ...@@ -38,14 +37,7 @@ from PageTemplate import PageTemplate
from Expressions import SecureModuleImporter from Expressions import SecureModuleImporter
from PageTemplateFile import PageTemplateFile from PageTemplateFile import PageTemplateFile
try: SUPPORTS_WEBDAV_LOCKS = 1
from webdav.Lockable import ResourceLockedError
from webdav.WriteLockInterface import WriteLockInterface
SUPPORTS_WEBDAV_LOCKS = 1
except ImportError:
SUPPORTS_WEBDAV_LOCKS = 0
class Src(Acquisition.Explicit): class Src(Acquisition.Explicit):
" " " "
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
############################################################################ ############################################################################
import re, time, sys import re, time, sys
from logging import getLogger
import Globals import Globals
from OFS.SimpleItem import Item from OFS.SimpleItem import Item
from Acquisition import Implicit, Explicit, aq_base from Acquisition import Implicit, Explicit, aq_base
...@@ -19,7 +20,6 @@ from Persistence import Persistent ...@@ -19,7 +20,6 @@ from Persistence import Persistent
from AccessControl.Owned import Owned from AccessControl.Owned import Owned
from AccessControl.Role import RoleManager from AccessControl.Role import RoleManager
from App.Management import Tabs from App.Management import Tabs
from zLOG import LOG, WARNING, BLATHER
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
import SessionInterfaces import SessionInterfaces
from SessionPermissions import * from SessionPermissions import *
...@@ -30,6 +30,7 @@ from ZPublisher.BeforeTraverse import registerBeforeTraverse, \ ...@@ -30,6 +30,7 @@ from ZPublisher.BeforeTraverse import registerBeforeTraverse, \
unregisterBeforeTraverse unregisterBeforeTraverse
bad_path_chars_in=re.compile('[^a-zA-Z0-9-_~\,\. \/]').search bad_path_chars_in=re.compile('[^a-zA-Z0-9-_~\,\. \/]').search
LOG = getLogger('SessionDataManager')
class SessionDataManagerErr(Exception): pass class SessionDataManagerErr(Exception): pass
...@@ -205,7 +206,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs): ...@@ -205,7 +206,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
transactions for mounted storages. """ transactions for mounted storages. """
if self.obpath is None: if self.obpath is None:
err = 'Session data container is unspecified in %s' % self.getId() err = 'Session data container is unspecified in %s' % self.getId()
LOG('Session Tracking', WARNING, err) LOG.warn(err)
raise SessionIdManagerErr, err raise SessionIdManagerErr, err
try: try:
# This should arguably use restrictedTraverse, but it # This should arguably use restrictedTraverse, but it
...@@ -215,8 +216,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs): ...@@ -215,8 +216,7 @@ class SessionDataManager(Item, Implicit, Persistent, RoleManager, Owned, Tabs):
# hasattr hides conflicts # hasattr hides conflicts
if DEBUG and not getattr(self, '_v_wrote_dc_type', None): if DEBUG and not getattr(self, '_v_wrote_dc_type', None):
args = '/'.join(self.obpath) args = '/'.join(self.obpath)
LOG('Session Tracking', BLATHER, LOG.debug('External data container at %s in use' % args)
'External data container at %s in use' % args)
self._v_wrote_dc_type = 1 self._v_wrote_dc_type = 1
return self.unrestrictedTraverse(self.obpath) return self.unrestrictedTraverse(self.obpath)
except: except:
...@@ -281,7 +281,7 @@ class SessionDataManagerTraverser(Persistent): ...@@ -281,7 +281,7 @@ class SessionDataManagerTraverser(Persistent):
getSessionData = sdm.getSessionData getSessionData = sdm.getSessionData
except: except:
msg = 'Session automatic traversal failed to get session data' msg = 'Session automatic traversal failed to get session data'
LOG('Session Tracking', WARNING, msg, error=sys.exc_info()) LOG.warn(msg, exc_info=sys.exc_info())
return return
# set the getSessionData method in the "lazy" namespace # set the getSessionData method in the "lazy" namespace
......
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