[Checkins] SVN: CMF/branches/2.1/C Fixed a bug in the site manager creation code, which would assign the __parent__ pointer to the Aq-wrapper and not the actual object. Also prevented the getMainGlobals script to fail if not content-type header is set.

Hanno Schlichting plone at hannosch.info
Tue Aug 28 13:31:44 EDT 2007


Log message for revision 79320:
  Fixed a bug in the site manager creation code, which would assign the __parent__ pointer to the Aq-wrapper and not the actual object. Also prevented the getMainGlobals script to fail if not content-type header is set.
  

Changed:
  U   CMF/branches/2.1/CHANGES.txt
  U   CMF/branches/2.1/CMFCore/PortalObject.py
  U   CMF/branches/2.1/CMFDefault/skins/zpt_generic/getMainGlobals.py

-=-
Modified: CMF/branches/2.1/CHANGES.txt
===================================================================
--- CMF/branches/2.1/CHANGES.txt	2007-08-28 16:27:54 UTC (rev 79319)
+++ CMF/branches/2.1/CHANGES.txt	2007-08-28 17:31:44 UTC (rev 79320)
@@ -2,6 +2,11 @@
 
   Bug Fixes
 
+    - Fixed a bug in the site manager creation code, which would assign the
+      __parent__ pointer to the Aq-wrapper and not the actual object. Also
+      prevented the getMainGlobals script to fail if not content-type header
+      is set.
+
     - AfterTransitionEvent now passes along the new status of the object, just
       as StateChangeInfo passes on the new status to after-transition scripts.
       (http://www.zope.org/Collectors/CMF/490)

Modified: CMF/branches/2.1/CMFCore/PortalObject.py
===================================================================
--- CMF/branches/2.1/CMFCore/PortalObject.py	2007-08-28 16:27:54 UTC (rev 79319)
+++ CMF/branches/2.1/CMFCore/PortalObject.py	2007-08-28 17:31:44 UTC (rev 79320)
@@ -15,6 +15,7 @@
 $Id$
 """
 
+from Acquisition import aq_base
 from five.localsitemanager import find_next_sitemanager
 from five.localsitemanager.registry import FiveVerifyingAdapterLookup
 from five.localsitemanager.registry import PersistentComponents
@@ -67,17 +68,19 @@
             if next is None:
                 next = base
             name = '/'.join(self.getPhysicalPath())
-            self._components = PersistentComponents(name, (next,))
-            self._components.__parent__ = self
+            self._components = components = PersistentComponents(name, (next,))
+            components.__parent__ = self
         elif self._components.utilities.LookupClass \
                 != FiveVerifyingAdapterLookup:
             # BBB: for CMF 2.1 beta instances
             # XXX: should be removed again after the CMF 2.1 release
-            self._components.utilities.LookupClass \
-                    = FiveVerifyingAdapterLookup
-            self._components.utilities._createLookup()
-            self._components.utilities.__parent__ = self._components
-            self._components.__parent__ = self
+            components = aq_base(self._components)
+            components.__parent__ = self
+            utilities = aq_base(components.utilities)
+            utilities.LookupClass = FiveVerifyingAdapterLookup
+            utilities._createLookup()
+            utilities.__parent__ = components
+            
         return self._components
 
     def __before_publishing_traverse__(self, arg1, arg2=None):

Modified: CMF/branches/2.1/CMFDefault/skins/zpt_generic/getMainGlobals.py
===================================================================
--- CMF/branches/2.1/CMFDefault/skins/zpt_generic/getMainGlobals.py	2007-08-28 16:27:54 UTC (rev 79319)
+++ CMF/branches/2.1/CMFDefault/skins/zpt_generic/getMainGlobals.py	2007-08-28 17:31:44 UTC (rev 79320)
@@ -13,7 +13,7 @@
 wtool = getToolByName(script, 'portal_workflow')
 portal_object = utool.getPortalObject()
 
-if not 'charset' in context.REQUEST.RESPONSE.getHeader('content-type'):
+if not 'charset' in (context.REQUEST.RESPONSE.getHeader('content-type') or ''):
     # Some newstyle views set a different charset - don't override it.
     # Oldstyle views need the default_charset.
     default_charset = ptool.getProperty('default_charset', None)



More information about the Checkins mailing list