[Zope-Checkins] CVS: Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.46.2.1

Jim Fulton cvs-admin at zope.org
Sat Nov 15 07:11:37 EST 2003


Update of /cvs-repository/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv24381/lib/python/Products/PageTemplates

Modified Files:
      Tag: zodb33-devel-branch
	ZopePageTemplate.py 
Log Message:
Changed class modification code to use setattr rather than class
dictionary manipulation, since new-style class dictionaries are
immutable


=== Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.46 => 1.46.2.1 ===
--- Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py:1.46	Sat Oct  4 14:56:58 2003
+++ Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py	Sat Nov 15 07:11:36 2003
@@ -45,6 +45,23 @@
 except ImportError:
     SUPPORTS_WEBDAV_LOCKS = 0
 
+
+
+class Src(Acquisition.Explicit):
+    " "
+
+    PUT = document_src = Acquisition.Acquired
+    index_html = None
+
+    def __before_publishing_traverse__(self, ob, request):
+        if getattr(request, '_hacked_path', 0):
+            request._hacked_path = 0
+
+    def __call__(self, REQUEST, RESPONSE):
+        " "
+        return self.document_src(REQUEST)
+
+
 class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
                        Traversable, PropertyManager):
     "Zope wrapper for Page Template using TAL, TALES, and METAL"
@@ -94,7 +111,7 @@
     security.declareProtected('View management screens',
       'pt_editForm', 'manage_main', 'read',
       'ZScriptHTML_tryForm', 'PrincipiaSearchSource',
-      'document_src', 'source.html', 'source.xml')
+      'document_src', 'source_dot_xml')
 
     security.declareProtected('FTP access',
       'manage_FTPstat','manage_FTPget','manage_FTPlist')
@@ -104,6 +121,8 @@
     pt_editForm._owner = None
     manage = manage_main = pt_editForm
 
+    source_dot_xml = Src()
+
     security.declareProtected('Change Page Templates',
       'pt_editAction', 'pt_setTitle', 'pt_edit',
       'pt_upload', 'pt_changePrefs')
@@ -294,24 +313,8 @@
         def wl_isLocked(self):
             return 0
 
-
-class Src(Acquisition.Explicit):
-    " "
-
-    PUT = document_src = Acquisition.Acquired
-    index_html = None
-
-    def __before_publishing_traverse__(self, ob, request):
-        if getattr(request, '_hacked_path', 0):
-            request._hacked_path = 0
-
-    def __call__(self, REQUEST, RESPONSE):
-        " "
-        return self.document_src(REQUEST)
-
-d = ZopePageTemplate.__dict__
-d['source.xml'] = d['source.html'] = Src()
-
+setattr(ZopePageTemplate, 'source.xml',  ZopePageTemplate.source_dot_xml)
+setattr(ZopePageTemplate, 'source.html', ZopePageTemplate.source_dot_xml)
 
 # Product registration and Add support
 manage_addPageTemplateForm = PageTemplateFile(




More information about the Zope-Checkins mailing list