[Zope3-dev] Re: Finding context in a vocabulary

Peter Mayne PeterMayne at ap.spherion.com
Fri Oct 1 00:25:42 EDT 2004


Stephan Richter wrote:
> 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.

Thanks, works perfectly. I can't see the forest for the trees at the moment.

PJDM
-- 
Peter Mayne
Spherion Technology Solutions
Canberra, ACT, Australia
"You're given the form, but you have to write the sonnet yourself.
What you say is completely up to you." - Mrs. Whatsit



More information about the Zope3-dev mailing list