[Product-Developers] get catalog from Nothing

Simone Orsi simahawk at gmail.com
Thu Jan 26 08:08:55 UTC 2012


Hi,

On 01/25/2012 05:59 PM, Gilles Lenfant wrote:
> Hi,
>
> Untested but this may work :
>
> pdb> from zope.component.hooks import getSite
> pdb> catalog = getSite().portal_catalog

yep this work as well as

catalog = getToolByName(getSite(), 'portal_catalog')

but - if I'm not wrong - I think you should import getSite as

from zope.site.hooks import getSite

Cheers
SimO


> ...
>
> HTH
> -- 
> Gilles Lenfant
> Le 25 janvier 2012 16:44, Maarten Nieber <maarten at usecm.com 
> <mailto:maarten at usecm.com>> a écrit :
>
>     Hi,
>
>     I'm back working on a plone site, and need to test something in
>     the debugger.
>     However, I don't know how to get the catalog.
>     I have no document to start from (for some reason my debugging
>     context only has
>     an exception object and some LDAP objects), so I cannot do the normal
>
>     catalog = getToolByName(self, 'portal_catalog')
>
>     Does anyone know how to get the catalog without having an object
>     to get it from?
>
>     Thanks,
>     Maarten
>
>     _______________________________________________
>     Product-Developers mailing list
>     Product-Developers at lists.plone.org
>     <mailto:Product-Developers at lists.plone.org>
>     https://lists.plone.org/mailman/listinfo/plone-product-developers
>
>
>
>
> -- 
> -- 
> Gilles LENFANT
> Ingénieur avant-vente - Architecte senior
> ALTER WAY SOLUTIONS
> T : 01 78 15 24 00
> F : 01 46 02 44 04
>
> Téléchargez notre nouveau livre blanc "Python, le développement autrement"
> http://www.alterway.fr/publications/python-le-developpement-autrement
>
> 1 rue Royal, Bat. D
> 227, les Bureaux de la Colinne
> 92210 Saint Cloud
> http://www.alterway.fr/solutions
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> https://lists.plone.org/mailman/listinfo/plone-product-developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20120126/956e9311/attachment.html>


More information about the Product-Developers mailing list