[Zope3-dev] Getting a database context from a resource

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Nov 5 06:42:46 EST 2004


On Thursday 04 November 2004 22:33, Peter Mayne wrote:
> Inside my dynamic resource, I need to access the Zope database to
> retrieve some data. However, since I'm in a resource, I don't have a
> context to traverse the database from.
>
> How do I get to the database without a starting point? All of the
> traverse methods I can find require an object/context to start from.

You can always get the active site using zapi.getSite() (trunk). If you need a 
more specific context, then your resource is not really a resource, but a 
view.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list