[Product-Developers] Grabbing app root in Product initialization ...

Maurits van Rees m.van.rees at zestsoftware.nl
Tue Nov 22 09:59:12 UTC 2011


Op 22-11-11 07:38, Alan Milligan schreef:
> Guys,
>
> Some time ago Zope app ProductContext changed such that upon Product
> initialization (circa Zope 2.12 I think), the root (and Control_Panel)
> is now no longer available.
>
> I've a couple of Plone products that expect the _ProductContext__app to
> have a handle to the root and it's persistent objects to auto-inject
> various controller objects (it is now None).
>
> What is the new technique to achieve this effect?
>
> Alan

I don't know, but you may be able to find something in the OFS package. 
  Products.PlacelessTranslationService (trunk/master) has this code that 
tries to get some similar info so it can look for an i18n directory in 
Products and registered packages:

try:
     # Zope 2.13+
     from OFS.metaconfigure import get_registered_packages
     get_registered_packages  # pyflakes
except ImportError:
     def get_registered_packages():
         import Products
         return getattr(Products, '_registered_packages', ())

from OFS.Application import get_products


-- 
Maurits van Rees   http://maurits.vanrees.org/
Web App Programmer at Zest Software: http://zestsoftware.nl
"Logical thinking shows conclusively that logical thinking
is inconclusive." - My summary of Gödel, Escher, Bach



More information about the Product-Developers mailing list