[Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate - PageTemplate.py:1.1.2.6

Jim Fulton jim@zope.com
Fri, 28 Dec 2001 10:35:00 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate
In directory cvs.zope.org:/tmp/cvs-serv9532

Modified Files:
      Tag: Zope-3x-branch
	PageTemplate.py 
Log Message:
Added fix to BoundPageTemplates to prevent simple attribute setting.



=== Zope3/lib/python/Zope/PageTemplate/PageTemplate.py 1.1.2.5 => 1.1.2.6 ===
 
 
-class BoundPageTemplate:
+class BoundPageTemplate(object):
     def __init__(self, pt, ob):
-        self.im_func = pt
-        self.im_self = ob
+        object.__setattr__(self, 'im_func', pt)
+        object.__setattr__(self, 'im_self', ob)
 
     def __call__(self, REQUEST=None, **kw):
         return self.im_func(self.im_self, REQUEST=REQUEST, **kw)
 
     def __getattr__(self, name):
         return getattr(self.im_func, name)
+
+    def __setattr__(self, name, v):
+        raise AttributeError("Can't set attribute", name)
 
     def __repr__(self):
         return "<BoundPageTemplateFile of %r>" % self.im_self