Thanks for this,

I'll try this for the next releases of my control panels (aws.zope2zcmldoc and 
aws.monkeypatcherpanel). They actually need a manual installation since I 
didn't find the way to add automatically a control panel at zope startup.

Cheers
-- 
Gilles Lenfant

Le 23 nov. 2011 à 11:37, Jean-Michel FRANCOIS a écrit :

> I have just fixed this on CallProfiler:
> 
> Note: it happens only with released eggs, not in develop mode ...
> 
> the fix:
> 
> 
>     try:
> 
> 
> 
>         from Zope2 import bobo_application
> 
> 
> 
>     except ImportError:
> 
> 
> 
>         bobo_application = None
> 
> 
> 
>     if bobo_application is not None:
> 
> 
> 
>         app = bobo_application()
> 
> 
> 
>     else:
> 
> 
> 
>         app = context._ProductContext__app
> 
> 
> 
>     cp = app.Control_Panel
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Regards / Cordialement,
> JeanMichel FRANCOIS
> Find me on Google +
> 
> 
> 
> 
> 2011/11/22 Maurits van Rees <[email protected]>
> 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
> 
> 
> _______________________________________________
> Product-Developers mailing list
> [email protected]
> https://lists.plone.org/mailman/listinfo/plone-product-developers
> 
> _______________________________________________
> Product-Developers mailing list
> [email protected]
> https://lists.plone.org/mailman/listinfo/plone-product-developers

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to