[Zope3-Users] how to access the root folder in normal operation

Shailesh Kumar shaileshk at gmail.com
Fri Nov 17 09:28:31 EST 2006


Thank you very much. This technique works perfectly.

-shailesh


On 11/17/06, Thierry Florac <thierry.florac at onf.fr> wrote:
>
> Le vendredi 17 novembre 2006 à 16:59 +0530, Shailesh Kumar a écrit :
> I currently use something like this, to handle a site configuration on
> startup (define catalog indexes...) :
>
>        from zope.app.appsetup.interfaces import \
>                IDatabaseOpenedWithRootEvent
>        from zope.app.publication.zopepublication import ZopePublication
>        from zope.component import adapter
>
>        @adapter(IDatabaseOpenedWithRootEvent)
>        def handleDatabaseOpenedWithRootEvent(event):
>            db = event.database
>            connection = db.open()
>            root = connection.root()
>            root_folder = root.get(ZopePublication.root_name, None)
>            ...
>
> And in ZCML :
>
>        <subscriber
>            handler=".handleDatabaseOpenedWithRootEvent" />
>
>
> Thierry Florac
> --
> Chef de projet intranet/internet
> Office National des Forêts - Département Informatique
> 2, Avenue de Saint-Mandé
> 75570 PARIS Cedex 12
> Mél : thierry.florac at onf.fr
> Tél. : +33 01.40.19.59.64
> Fax. : +33 01.40.19.59.85
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20061117/2e0e9eb9/attachment.htm


More information about the Zope3-users mailing list