[Zope3-Users] Re: Traversing to nearest site

jürgen Kartnaller j.kartnaller at cable.vol.at
Fri Mar 25 15:29:15 EST 2005


Thanks, to let me know that I'm right :)

Jürgen

Philipp von Weitershausen wrote:
> jürgen Kartnaller wrote:
> 
>> Ok,
>> nobody knows, me too.
> 
> 
> I knew, but you were too quick :)
> 
>> I did this :
>>
>> I implemented a traverser :
>>
>>
>> from zope.app.component.hooks import getSite
>> from zope.app.traversing.namespace import SimpleHandler
>>
>> class site(SimpleHandler):
>>
>>     def traverse(self, name, ignored):
>>         return getSite()
>>
>>
>> And registered it this way in my configure.zcml :
>>
>>   <adapter
>>       name="site"
>>       provides="zope.app.traversing.interfaces.ITraversable" for="*"
>>       factory="coma.traversing.site"
>>     />
>>   <view
>>       name="site"
>>       type="*"
>>       provides="zope.app.traversing.interfaces.ITraversable" for="*"
>>       factory="coma.traversing.site"
>>     />
>>
>> Now I can use ++site++ to traverse to the nearest site.
>>
>> Can one of you geeks please let me know if this is the right way to 
>> implement this feature ?
> 
> 
> Yes. Well done.
> 
> Philipp



More information about the Zope3-users mailing list