[Zope-Checkins] SVN: Products.Five/branches/1.3/ Fix CHANGES.TXT and add fix for pagetemplatefile needed for working forms

Alec Mitchell apm13 at columbia.edu
Tue May 2 15:57:16 EDT 2006


Log message for revision 67858:
  Fix CHANGES.TXT and add fix for pagetemplatefile needed for working forms
  

Changed:
  U   Products.Five/branches/1.3/CHANGES.txt
  U   Products.Five/branches/1.3/browser/pagetemplatefile.py

-=-
Modified: Products.Five/branches/1.3/CHANGES.txt
===================================================================
--- Products.Five/branches/1.3/CHANGES.txt	2006-05-02 19:50:45 UTC (rev 67857)
+++ Products.Five/branches/1.3/CHANGES.txt	2006-05-02 19:57:15 UTC (rev 67858)
@@ -8,8 +8,6 @@
 Bugfixes
 --------
 
-* Made sure that events are fired as expected in add and edit forms.
-
 * Made sure LocalizerLanguages class normalized language codes to
   xx-yy, instead of xx_YY or xx-YY.
 
@@ -281,18 +279,18 @@
 
 * When Zope was not in debug mode, an error in a ZCML file would cause Five to
   stop loading ZCML completely, making all subsequent products "dead". The
-  effect would typically be that objects appeared to have no views at all. 
-  Now a ZCML error will only stop the ZCML loading for that product, but the 
-  rest of the products will load as usual. A traceback will still be printed 
+  effect would typically be that objects appeared to have no views at all.
+  Now a ZCML error will only stop the ZCML loading for that product, but the
+  rest of the products will load as usual. A traceback will still be printed
   in the event log.
 
-  In debug mode the behaviour has not changed; a ZCML error will stop Zope 
+  In debug mode the behaviour has not changed; a ZCML error will stop Zope
   startup completely, and print a traceback if running in foreground mode.
-  
+
 Restructuring
 -------------
 
-* The deprecated FivePageTemplateFile was removed, and the erroneous use of 
+* The deprecated FivePageTemplateFile was removed, and the erroneous use of
   this by EditView was changed.
 
 Bugfixes
@@ -303,7 +301,7 @@
   Note that this test fails on Zope 2.8.1, which incorrectly ignored
   'handle_errors'.
 
-* FiveTraversable should only do a view lookup and not call the traverse 
+* FiveTraversable should only do a view lookup and not call the traverse
   method of its superclass.
 
 * Fixed manage_beforeDelete triggering for classes using five:sendEvents.
@@ -318,13 +316,13 @@
 
 * 'zope' domain translations are now set up by default. Form i18n needs them.
 
-* Added backwards compatibility for some moved classes (AddForm, EditForm, 
+* Added backwards compatibility for some moved classes (AddForm, EditForm,
   ContentAdding)
 
 * The ZPT variable 'container' makes little sense in Zope3/Five, but is now
   always set to be the same as 'here' which is normal Zope2 behaviour.
   It is in Five 1.0.x set to be the same as 'view' which breaks some templates.
-  
+
 * In some hard to replicate cases, using the "modules" variable in ZPT cause
   an AuthenticationError. Using the secure module importer fixes this.
 

Modified: Products.Five/branches/1.3/browser/pagetemplatefile.py
===================================================================
--- Products.Five/branches/1.3/browser/pagetemplatefile.py	2006-05-02 19:50:45 UTC (rev 67857)
+++ Products.Five/branches/1.3/browser/pagetemplatefile.py	2006-05-02 19:57:15 UTC (rev 67858)
@@ -34,10 +34,10 @@
     Uses Zope 2's engine, but with security disabled and with some
     initialization and API from Zope 3.
     """
-        
+
     def __init__(self, filename, _prefix=None, content_type=None):
         # XXX doesn't use content_type yet
-        
+
         self.ZBindings_edit(self._default_bindings)
 
         path = self.get_path_from_prefix(_prefix)
@@ -47,7 +47,7 @@
 
         basepath, ext = os.path.splitext(self.filename)
         self.__name__ = os.path.basename(basepath)
- 
+
     def get_path_from_prefix(self, _prefix):
         if isinstance(_prefix, str):
             path = _prefix
@@ -55,24 +55,24 @@
             if _prefix is None:
                 _prefix = sys._getframe(2).f_globals
             path = package_home(_prefix)
-        return path 
+        return path
 
     _cook = rebindFunction(PageTemplateFile._cook,
                            getEngine=getEngine)
-    
+
     pt_render = rebindFunction(PageTemplateFile.pt_render,
                                getEngine=getEngine)
 
     def _pt_getContext(self):
         try:
             root = self.getPhysicalRoot()
-            view = self._getContext()
         except AttributeError:
-            # self has no attribute getPhysicalRoot. This typically happens 
-            # when the template has no proper acquisition context. 
-            # That also means it has no view.  /regebro
             root = self.context.getPhysicalRoot()
-            view = None
+        # Even if the context isn't a view (when would that be exaclty?),
+        # there shouldn't be any dange in applying a view, because it
+        # won't be used.  However assuming that a lack of getPhysicalRoot
+        # implies a missing view causes problems.
+        view = self._getContext()
 
         here = self.context.aq_inner
 
@@ -87,7 +87,7 @@
              'request': request,
              'modules': ModuleImporter,
              }
-        if view:
+        if view is not None:
             c['view'] = view
             c['views'] = ViewMapper(here, request)
 



More information about the Zope-Checkins mailing list