[ZPT] CVS: Products/PageTemplates - CHANGES.txt:1.17.2.5 Expressions.py:1.19.2.2 HISTORY.txt:1.3.2.2 PageTemplateFile.py:1.3.2.2 ZopePageTemplate.py:1.16.2.4 version.txt:1.7.2.1

Evan Simpson evan@zope.com
Mon, 15 Oct 2001 10:00:12 -0400


Update of /cvs-repository/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv25999

Modified Files:
      Tag: zpt-1_4_0
	CHANGES.txt Expressions.py HISTORY.txt PageTemplateFile.py 
	ZopePageTemplate.py version.txt 
Log Message:
Fix PageTemplateFile cooking and __name__ handling.


=== Products/PageTemplates/CHANGES.txt 1.17.2.4 => 1.17.2.5 ===
   file HISTORY.txt.
 
-    Version 1.4.1
+    Version 1.4.2
 
       Bugs Fixed
 
-        - Tracebacks were often truncated.
+        - PageTemplateFiles didn't _cook_check() when their macros
+          were accessed.
 
-        - __bobo_traverse__ objects, such as the root, triggered
-          security incorrectly when traversed.
+        - __name__ handling was incorrect.
 
-        - If a PageTemplate was owned by a missing user, or one with
-          insufficient permissions, the editing form broke.
-
-        - PageTemplateFiles didn't bind 'user'.
-
-        - There was no help.
+        - There was an unnecessary circular import between
+          ZopePageTemplate and PageTemplateFile.
+ 


=== Products/PageTemplates/Expressions.py 1.19.2.1 => 1.19.2.2 ===
         from ZPythonExpr import PythonExpr, _SecureModuleImporter, \
              call_with_ns
+    SecureModuleImporter = _SecureModuleImporter()
 else:
     from PythonExpr import getSecurityManager, PythonExpr
     def call_with_ns(f, ns, arg=1):


=== Products/PageTemplates/HISTORY.txt 1.3.2.1 => 1.3.2.2 ===
   in the file CHANGES.txt.
 
+    Version 1.4.1
+
+      Bugs Fixed
+
+        - Tracebacks were often truncated.
+
+        - __bobo_traverse__ objects, such as the root, triggered
+          security incorrectly when traversed.
+
+        - If a PageTemplate was owned by a missing user, or one with
+          insufficient permissions, the editing form broke.
+
+        - PageTemplateFiles didn't bind 'user'.
+
+        - There was no help.
+
     Version 1.4.0
 
       Features Added


=== Products/PageTemplates/PageTemplateFile.py 1.3.2.1 => 1.3.2.2 ===
 from OFS.Traversable import Traversable
 from PageTemplate import PageTemplate
-from ZopePageTemplate import SecureModuleImporter
+from Expressions import SecureModuleImporter
 from ComputedAttribute import ComputedAttribute
+from ExtensionClass import Base
+
+class MacroCollection(Base):
+    def __of__(self, parent):
+        parent._cook_check()
+        return parent._v_macros
 
 class PageTemplateFile(Script, PageTemplate, Traversable):
     "Zope wrapper for filesystem Page Template using TAL, TALES, and METAL"
@@ -110,6 +116,7 @@
     func_code = FuncCode((), 0)
     _need__name__=1
     _v_last_read=0
+    macros = MacroCollection()
 
     _default_bindings = {'name_subpath': 'traverse_subpath'}
 
@@ -125,9 +132,9 @@
         elif type(_prefix) is not type(''):
             _prefix = package_home(_prefix)
         name = kw.get('__name__')
-        if not name:
-            name = os.path.split(filename)[-1]
-        self.__name__ = name
+        if name:
+            self._need__name__ = 0
+            self.__name__ = name
         self.filename = filename = os.path.join(_prefix, filename + '.zpt')
 
     def pt_getContext(self):


=== Products/PageTemplates/ZopePageTemplate.py 1.16.2.3 => 1.16.2.4 ===
 from PageTemplate import PageTemplate
 from TALES import TALESError
+from Expressions import SecureModuleImporter
+from PageTemplateFile import PageTemplateFile
 
 try:
     from webdav.Lockable import ResourceLockedError
@@ -124,7 +126,7 @@
     func_defaults = None
     func_code = FuncCode((), 0)
 
-    _default_bindings = {'name_subpath': 'traverse_subpath'}
+    _default_bindings = {}
     _default_content_fn = os.path.join(package_home(globals()),
                                        'www', 'default.html')
 
@@ -162,6 +164,11 @@
       'ZScriptHTML_tryForm', 'PrincipiaSearchSource',
       'document_src', 'source.html', 'source.xml')
 
+    pt_editForm = PageTemplateFile('www/ptEdit', globals(),
+                                   __name__='pt_editForm')
+    pt_editForm._owner = None
+    manage = manage_main = pt_editForm
+
     security.declareProtected('Change Page Templates',
       'pt_editAction', 'pt_setTitle', 'pt_edit',
       'pt_upload', 'pt_changePrefs')
@@ -333,10 +340,9 @@
 d = ZopePageTemplate.__dict__
 d['source.xml'] = d['source.html'] = Src()
 
-from Expressions import _SecureModuleImporter
-SecureModuleImporter = _SecureModuleImporter()
-
 # Product registration and Add support
+manage_addPageTemplateForm = PageTemplateFile('www/ptAdd', globals())
+
 from urllib import quote
 
 def manage_addPageTemplate(self, id, title=None, text=None,
@@ -366,16 +372,7 @@
         REQUEST.RESPONSE.redirect(u+'/manage_main')
     return ''
 
-#manage_addPageTemplateForm = DTMLFile('dtml/ptAdd', globals())
-
 def initialize(context):
-    from PageTemplateFile import PageTemplateFile
-    manage_addPageTemplateForm = PageTemplateFile('www/ptAdd', globals())
-    _editForm = PageTemplateFile('www/ptEdit', globals())
-    ZopePageTemplate.manage = _editForm
-    ZopePageTemplate.manage_main = _editForm
-    ZopePageTemplate.pt_editForm = _editForm
-    _editForm._owner = None
     context.registerClass(
         ZopePageTemplate,
         permission='Add Page Templates',


=== Products/PageTemplates/version.txt 1.7 => 1.7.2.1 ===
+PageTemplates-1-4-1