Commit 29e70622 authored by Ken Manheimer's avatar Ken Manheimer

Merging (apparent) nested-scopes problem workaround from

Zope-2_4-branch.
parent d6f2fe73
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
from __future__ import nested_scopes from __future__ import nested_scopes
__version__='$Revision: 1.5 $'[11:-2] __version__='$Revision: 1.6 $'[11:-2]
import new import new
...@@ -109,7 +109,7 @@ def _full_read_guard(g_attr, g_item): ...@@ -109,7 +109,7 @@ def _full_read_guard(g_attr, g_item):
# The arguments are used by class Wrapper # The arguments are used by class Wrapper
# safetype variable is used by guard() # safetype variable is used by guard()
safetype = {type(()): 1, type([]): 1, type({}): 1, type(''): 1}.has_key safetype = {type(()): 1, type([]): 1, type({}): 1, type(''): 1}.has_key
def guard(ob, write=None): def guard(ob, write=None, safetype=safetype):
# Don't bother wrapping simple types, or objects that claim to # Don't bother wrapping simple types, or objects that claim to
# handle their own read security. # handle their own read security.
if safetype(type(ob)) or getattr(ob, '_guarded_reads', 0): if safetype(type(ob)) or getattr(ob, '_guarded_reads', 0):
...@@ -165,7 +165,7 @@ def _full_write_guard(): ...@@ -165,7 +165,7 @@ def _full_write_guard():
# safetype and Wrapper variables are used by guard() # safetype and Wrapper variables are used by guard()
safetype = {type([]): 1, type({}): 1}.has_key safetype = {type([]): 1, type({}): 1}.has_key
Wrapper = _write_wrapper() Wrapper = _write_wrapper()
def guard(ob): def guard(ob, safetype=safetype, Wrapper=Wrapper):
# Don't bother wrapping simple types, or objects that claim to # Don't bother wrapping simple types, or objects that claim to
# handle their own write security. # handle their own write security.
if safetype(type(ob)) or hasattr(ob, '_guarded_writes'): if safetype(type(ob)) or hasattr(ob, '_guarded_writes'):
......
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