Commit e37cf333 authored by Shane Hathaway's avatar Shane Hathaway

Added the RestrictedDTML class, a mix-in for derivatives of

DT_String.String that adds Zope security.
parent ddea6236
...@@ -84,13 +84,26 @@ ...@@ -84,13 +84,26 @@
############################################################################## ##############################################################################
'''Add security system support to Document Templates '''Add security system support to Document Templates
$Id: DTML.py,v 1.6 2001/06/19 23:15:41 andreas Exp $''' $Id: DTML.py,v 1.7 2001/06/21 17:16:31 shane Exp $'''
__version__='$Revision: 1.6 $'[11:-2] __version__='$Revision: 1.7 $'[11:-2]
from DocumentTemplate import DT_Util from DocumentTemplate import DT_Util
import SecurityManagement, string, math, whrandom, random import SecurityManagement, string, math, whrandom, random
import DocumentTemplate.sequence import DocumentTemplate.sequence
from ZopeGuards import guarded_getattr, guarded_getitem, _marker
class RestrictedDTML:
'''
A mix-in for derivatives of DT_String.String that adds Zope security.
'''
def guarded_getattr(self, ob, name, default=_marker):
return guarded_getattr(ob, name, default)
def guarded_getitem(self, ob, index):
return guarded_getitem(ob, index)
# Allow access to unprotected attributes # Allow access to unprotected attributes
DT_Util.TemplateDict.__allow_access_to_unprotected_subobjects__=1 DT_Util.TemplateDict.__allow_access_to_unprotected_subobjects__=1
string.__allow_access_to_unprotected_subobjects__=1 string.__allow_access_to_unprotected_subobjects__=1
......
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