[Zope-Checkins] CVS: Zope2 - DTML.py:1.7
shane@digicool.com
shane@digicool.com
Thu, 21 Jun 2001 13:16:32 -0400 (EDT)
Update of /cvs-repository/Zope2/lib/python/AccessControl
In directory korak.digicool.com:/tmp/cvs-serv23865
Modified Files:
DTML.py
Log Message:
Added the RestrictedDTML class, a mix-in for derivatives of
DT_String.String that adds Zope security.
--- Updated File DTML.py in package Zope2 --
--- DTML.py 2001/06/19 23:15:41 1.6
+++ DTML.py 2001/06/21 17:16:31 1.7
@@ -91,6 +91,19 @@
import SecurityManagement, string, math, whrandom, random
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
DT_Util.TemplateDict.__allow_access_to_unprotected_subobjects__=1
string.__allow_access_to_unprotected_subobjects__=1