Skip to content

Commit

Permalink
Get rid of fake ModuleSecurity module
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Simpson committed Dec 5, 2000
1 parent be0cb73 commit 1d08341
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 123 deletions.
19 changes: 8 additions & 11 deletions Guarded.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#
##############################################################################

__version__='$Revision: 1.2 $'[11:-2]
__version__='$Revision: 1.3 $'[11:-2]

from zbytecodehacks.VSExec import SafeBlock, GuardedBinaryOps, \
UntupleFunction, RedirectWrites, WriteGuard, RedirectReads, ReadGuard, \
Expand All @@ -92,10 +92,10 @@
from DocumentTemplate.DT_Util import TemplateDict, \
careful_pow, d, ValidationError
from DocumentTemplate.DT_Var import special_formats
from AccessControl import getSecurityManager, getModuleSecurity
from AccessControl import getSecurityManager, secureModule

import standard
standard.__allow_access_to_unprotected_subobjects__ = 1
#import standard
#standard.__allow_access_to_unprotected_subobjects__ = 1

safefuncs = TemplateDict()
safebin = {}
Expand Down Expand Up @@ -222,7 +222,6 @@ def __careful_import__(mname, globals={}, locals={}, fromlist=None):

def load_module(module, mname, mnameparts, validate, globals, locals):
modules = sys.modules
modsec = getModuleSecurity()
while mnameparts:
nextname = mnameparts.pop(0)
if mname is None:
Expand All @@ -231,13 +230,11 @@ def load_module(module, mname, mnameparts, validate, globals, locals):
mname = '%s.%s' % (mname, nextname)
nextmodule = modules.get(mname, None)
if nextmodule is None:
if not modsec.has_key(mname):
nextmodule = secureModule(mname, globals, locals)
if nextmodule is None:
return
__import__(mname, globals, locals)
nextmodule = modules[mname]
if not hasattr(nextmodule, 'ZopeSecurity'):
nextmodule.ZopeSecurity = zs = modsec[mname]
zs.apply(nextmodule)
else:
secureModule(mname)
if module and not validate(module, module, nextname, nextmodule):
return
module = nextmodule
Expand Down
108 changes: 0 additions & 108 deletions ModuleSecurity.py

This file was deleted.

7 changes: 3 additions & 4 deletions standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@
"import Products.PythonScripts.standard"
"""

__version__='$Revision: 1.1 $'[11:-2]
__version__='$Revision: 1.2 $'[11:-2]

from AccessControl import ModuleSecurityInfo
from AccessControl import ModuleSecurityInfo, getSecurityManager
security = ModuleSecurityInfo()

security.public('special_formats')
from DocumentTemplate.DT_Var import special_formats

from Globals import HTML
from AccessControl import getSecurityManager

security.public('DTML')
class DTML(HTML):
Expand All @@ -119,5 +118,5 @@ def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
def validate(self, inst, parent, name, value, md):
return getSecurityManager().validate(inst, parent, name, value)


security.apply(globals())

0 comments on commit 1d08341

Please sign in to comment.