Re: [Zope-dev] ZDebug patch for 2.3.0
Chris Withers wrote: The patch below got ZDebug working with Zope 2.3.0 for me. Hope I didn't miss anything ;-) Good job, Chris! I patched it in a similar way. I planned to release a new version as soon as I was sure it worked well with 2.3. Shane --- debugsecuritypolicy.py.old Sun Jan 28 21:59:23 2001 +++ debugsecuritypolicy.py Sun Jan 28 22:07:21 2001 @@ -89,7 +89,7 @@ __version__='$Revision: 1.4 $'[11:-2] from AccessControl import SimpleObjectPolicies -_noroles=[] +_noroles=SimpleObjectPolicies._noroles from AccessControl.PermissionRole import \ _what_not_even_god_should_do, rolesForPermissionOn @@ -99,7 +99,7 @@ class DebugSecurityPolicy: def validate(self, accessed, container, name, value, context, - None=None, type=type, IntType=type(0), DictType=type({}), + roles=_noroles, None=None, type=type, IntType=type(0), DictType=type({}), getattr=getattr, _noroles=_noroles, StringType=type(''), Containers=SimpleObjectPolicies.Containers, valid_aq_=('aq_parent','aq_explicit')): @@ -116,7 +116,8 @@ # Try to get roles -roles=getattr(value, '__roles__', _noroles) +if roles is _noroles: +roles=getattr(value, '__roles__', _noroles) if roles is _noroles: @@ -174,7 +175,14 @@ value=container # Short-circuit tests if we can: -if roles is None or 'Anonymous' in roles: return 1 +try: +if roles is None or 'Anonymous' in roles: 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." % ( +`roles`, name)) +raise # Check executable security stack=context.stack ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ZDebug patch for 2.3.0
Thanks! Good to have ZDebug back. But... it kills LoginManager, which uses an exception to render the login page. This patch will fix the problem: --- DTMLDebug.py.old Fri Sep 15 09:25:14 2000 +++ DTMLDebug.pyTue Jan 30 10:45:43 2001 @@ -217,6 +217,9 @@ elif exc_type is DTReturn: # Return normally. raise +elif str(exc_type) == 'LoginRequired': +# Don't interfere with LoginManager. +raise else: debugWithNamespace(section, namespace, None, info) finally: Chris Withers wrote: The patch below got ZDebug working with Zope 2.3.0 for me. Hope I didn't miss anything ;-) cheers, Chris snip patch -- -- Itai Tavor -- "Je sautille, donc je suis."-- [EMAIL PROTECTED]-- - Kermit the Frog -- -- 'Supposing a tree fell down, Pooh, when we were underneath it?' -- -- 'Supposing it didn't,' said Pooh after careful thought. -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ZDebug patch for 2.3.0
The patch below got ZDebug working with Zope 2.3.0 for me. Hope I didn't miss anything ;-) cheers, Chris --- debugsecuritypolicy.py.old Sun Jan 28 21:59:23 2001 +++ debugsecuritypolicy.py Sun Jan 28 22:07:21 2001 @@ -89,7 +89,7 @@ __version__='$Revision: 1.4 $'[11:-2] from AccessControl import SimpleObjectPolicies -_noroles=[] +_noroles=SimpleObjectPolicies._noroles from AccessControl.PermissionRole import \ _what_not_even_god_should_do, rolesForPermissionOn @@ -99,7 +99,7 @@ class DebugSecurityPolicy: def validate(self, accessed, container, name, value, context, - None=None, type=type, IntType=type(0), DictType=type({}), + roles=_noroles, None=None, type=type, IntType=type(0), DictType=type({}), getattr=getattr, _noroles=_noroles, StringType=type(''), Containers=SimpleObjectPolicies.Containers, valid_aq_=('aq_parent','aq_explicit')): @@ -116,7 +116,8 @@ # Try to get roles -roles=getattr(value, '__roles__', _noroles) +if roles is _noroles: +roles=getattr(value, '__roles__', _noroles) if roles is _noroles: @@ -174,7 +175,14 @@ value=container # Short-circuit tests if we can: -if roles is None or 'Anonymous' in roles: return 1 +try: +if roles is None or 'Anonymous' in roles: 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." % ( +`roles`, name)) +raise # Check executable security stack=context.stack ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )