[Zope-CMF] Re: Where is getProperty?

yuppie y.2007- at wcm-solutions.de
Fri Jun 29 05:04:26 EDT 2007


Charlie Clark wrote:
> 
> Am 29.06.2007 um 10:37 schrieb yuppie:
> 
>> Looks like your utility isn't acquisition wrapped - getProperty is 
>> usually acquired from the site root.
>>
>> 1.) Your site seems to broken, there is currently no migration code 
>> that updates the lookup class if you have an old site manager instance.
>>
>> 2.) getProperty should become part of the IPropertiesTool interface 
>> and implementation. It should not rely on acquisition.
> 
> It's coming from the index_html.py script:
> 
> return context.index_html_template(**decode(options, script))
> 
> How should I be wrapping that?

You shouldn't, getUtility should.

Can you please test the attached patch? It should fix your site manager 
instance on the fly.

Cheers, Yuppie



Index: CMFCore/PortalObject.py
===================================================================
--- CMFCore/PortalObject.py	(revision 77185)
+++ CMFCore/PortalObject.py	(working copy)
@@ -16,6 +16,7 @@
  """

  from five.localsitemanager import find_next_sitemanager
+from five.localsitemanager.registry import FiveVerifyingAdapterLookup
  from five.localsitemanager.registry import PersistentComponents
  from Globals import InitializeClass
  from Products.Five.component.interfaces import IObjectManagerSite
@@ -67,6 +68,11 @@
              name = '/'.join(self.getPhysicalPath())
              self._components = PersistentComponents(name, (next,))
              self._components.__parent__ = self
+        elif self._components.utilities.LookupClass != 
FiveVerifyingAdapterLookup:
+            self._components.utilities.LookupClass = 
FiveVerifyingAdapterLookup
+            self._components.utilities._createLookup()
+            self._components.utilities.__parent__ = self._components
+            self._components.__parent__ = self
          return self._components

      def __before_publishing_traverse__(self, arg1, arg2=None):



More information about the Zope-CMF mailing list