[Zope3-dev] Finding context in a vocabulary
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Sep 30 08:38:33 EDT 2004
On Thursday 30 September 2004 01:00, Peter Mayne wrote:
> I can follow the instructions in the handbook to create a vocabulary,
> but within the vocabulary class, I can't see how to ascertain where in
> the database my object is. The example in the handbook uses a container
> class, so the folder is implicit in the class, but in my case my
> vocabulary gets an instance of my non-container class, and I can't see
> how to discover the folder in which it exists. Besides, in the future, I
> may want to add sub-folders, peer folders, etc.
You can go up the tree using zapi.getParent(obj). You have to inspect your
context manually and specifically for your use case to collect the data. Look
at the ManagableVocabulary code in the bug tracker for another advanced
example.
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