Commit a6fb6824 authored by Andreas Jung's avatar Andreas Jung

zLOG -> logging

parent 282104fb
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
import os import os
import string import string
from logging import getLogger
from Acquisition import aq_base from Acquisition import aq_base
from Acquisition import aq_parent from Acquisition import aq_parent
from Acquisition import aq_inner from Acquisition import aq_inner
from Acquisition import aq_acquire from Acquisition import aq_acquire
from ExtensionClass import Base from ExtensionClass import Base
from zLOG import LOG, BLATHER, PROBLEM
from zope.interface import implements from zope.interface import implements
# This is used when a permission maps explicitly to no permission. We # This is used when a permission maps explicitly to no permission. We
...@@ -39,6 +39,7 @@ from AccessControl.interfaces import ISecurityManager ...@@ -39,6 +39,7 @@ from AccessControl.interfaces import ISecurityManager
from AccessControl.SimpleObjectPolicies import Containers, _noroles from AccessControl.SimpleObjectPolicies import Containers, _noroles
from AccessControl.ZopeGuards import guarded_getitem from AccessControl.ZopeGuards import guarded_getitem
LOG = getLogger('ImplPython')
# AccessControl.PermissionRole # AccessControl.PermissionRole
# ---------------------------- # ----------------------------
...@@ -346,7 +347,7 @@ class ZopeSecurityPolicy: ...@@ -346,7 +347,7 @@ class ZopeSecurityPolicy:
return 1 return 1
except TypeError: except TypeError:
# 'roles' isn't a sequence # 'roles' isn't a sequence
LOG('Zope Security Policy', PROBLEM, "'%s' passed as roles" LOG.error("'%s' passed as roles"
" during validation of '%s' is not a sequence." % ( " during validation of '%s' is not a sequence." % (
`roles`, name)) `roles`, name))
raise raise
...@@ -804,7 +805,7 @@ def raiseVerbose(msg, accessed, container, name, value, context, ...@@ -804,7 +805,7 @@ def raiseVerbose(msg, accessed, container, name, value, context,
info.append(s + '.') info.append(s + '.')
text = ' '.join(info) text = ' '.join(info)
LOG('Zope Security Policy', BLATHER, 'Unauthorized: %s' % text) LOG.debug('Unauthorized: %s' % text)
raise Unauthorized(text) raise Unauthorized(text)
def getUserRolesInContext(user, context): def getUserRolesInContext(user, context):
......
...@@ -39,11 +39,13 @@ ...@@ -39,11 +39,13 @@
""" """
import sys import sys
from logging import getLogger
import Acquisition import Acquisition
from AccessControl.ImplPython import _what_not_even_god_should_do from AccessControl.ImplPython import _what_not_even_god_should_do
from zLOG import LOG, WARNING
LOG = getLogger('SecurityInfo')
# Security constants - these are imported into the AccessControl # Security constants - these are imported into the AccessControl
...@@ -69,8 +71,7 @@ class SecurityInfo(Acquisition.Implicit): ...@@ -69,8 +71,7 @@ class SecurityInfo(Acquisition.Implicit):
def _setaccess(self, names, access): def _setaccess(self, names, access):
for name in names: for name in names:
if self.names.get(name, access) != access: if self.names.get(name, access) != access:
LOG('SecurityInfo', WARNING, 'Conflicting security ' LOG.warn('Conflicting security declarations for "%s"' % name)
'declarations for "%s"' % name)
self._warnings = 1 self._warnings = 1
self.names[name] = access self.names[name] = access
...@@ -111,7 +112,7 @@ class SecurityInfo(Acquisition.Implicit): ...@@ -111,7 +112,7 @@ class SecurityInfo(Acquisition.Implicit):
for role in roles: for role in roles:
rdict[role] = 1 rdict[role] = 1
if self.roles.get(permission_name, rdict) != rdict: if self.roles.get(permission_name, rdict) != rdict:
LOG('SecurityInfo', WARNING, 'Conflicting default role' LOG.warn('Conflicting default role'
'declarations for permission "%s"' % permission_name) 'declarations for permission "%s"' % permission_name)
self._warnings = 1 self._warnings = 1
self.roles[permission_name] = rdict self.roles[permission_name] = rdict
...@@ -193,7 +194,7 @@ class ClassSecurityInfo(SecurityInfo): ...@@ -193,7 +194,7 @@ class ClassSecurityInfo(SecurityInfo):
access) access)
if getattr(self, '_warnings', None): if getattr(self, '_warnings', None):
LOG('SecurityInfo', WARNING, 'Class "%s" had conflicting ' LOG.warn('Class "%s" had conflicting '
'security declarations' % classobj.__name__) 'security declarations' % classobj.__name__)
class ClassSecurityInformation(ClassSecurityInfo): class ClassSecurityInformation(ClassSecurityInfo):
...@@ -273,7 +274,7 @@ class _ModuleSecurityInfo(SecurityInfo): ...@@ -273,7 +274,7 @@ class _ModuleSecurityInfo(SecurityInfo):
dict['__allow_access_to_unprotected_subobjects__'] = self dict['__allow_access_to_unprotected_subobjects__'] = self
if getattr(self, '_warnings', None): if getattr(self, '_warnings', None):
LOG('SecurityInfo', WARNING, 'Module "%s" had conflicting ' LOG.warn('Module "%s" had conflicting '
'security declarations' % dict['__name__']) 'security declarations' % dict['__name__'])
declareProtected__roles__=ACCESS_PRIVATE declareProtected__roles__=ACCESS_PRIVATE
......
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