Tom Dossis wrote:

> Christian Lueck wrote:
>
>> Note: Since I don't know how to get into a site's context with the
>> debugger (zopectl debug) ...
>
>
> Hi Christian, here's some code to get the root object of a zope3/zeo
> site...
>
> >>> from ZODB import DB
> >>> from ZEO.ClientStorage import ClientStorage
> >>> from zope.app.debug import Debugger
> >>>
> >>> zeohost = 'localhost'
> >>> zeoport = 8131
> >>> sitezcml = 'etc/site.zcml'
> >>>
> >>> db = DB(ClientStorage((zeohost,zeoport)))
> >>> root = Debugger(db, sitezcml).root()
> >>>
> >>> root
> <zope.app.folder.folder.Folder object at 0x411f04ac>
> >>>
> >>> list(root)
> [u'td']
> >>>
> >>> site = root['td']
>
> If you make changes to objects via the python interactive session and
> want to see them from your browser...
>
> >>> import transaction
> >>> transaction.commit()
>
> For a non-zeo zope3 site, it's simply..
>
> >>> db = 'var/Data.fs'
> >>> sitezcml = 'etc/site.zcml'
> >>> root = Debugger(db, sitezcml).root()
>
> Note: The above references to the db and sitezcml are relative to your
> instance. And of course don't forget to include zope and your stuff in
> your PYTHONPATH
>
Hi Tom,
cool! Now I'm able to set a site:

>>> from zope.app.debug import Debugger
>>> debugger = Debugger('var/Data.fs', 'etc/site.zcml')
>>> root = debugger.root()
>>> from zope.app.component.hooks import setSite
>>> setSite(root)

:-) THANKS

Christian


_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to