History for MessingWithTraversal
??changed:
-
<p>When an object is traversed over, this method is called. Key is the object to find, to show normal behaviour, return key. To stop all traversal, return self.</p>
<p>
<pre>
def __bobo_traverse__(self, REQUEST, key):
''' no more traversal '''
return self
</pre>
</p>
<p>Then inside the __call__ method you can access the REQUEST variable to get the PATH_INFO, or you could do build up a class variable as the __bobo_traverse__ gets called.</p>
<pre>
def __call__(self, REQUEST):
''' do something '''
return "%s" % REQUEST{'PATH_INFO'}
</pre>
* replace { with [
<p>The only problem is here that the travesal is actually happening, for each element in the url. It would be nice to simply the traversal at the first chance...
</p>
<hr solid id=comments_below>
tseaver (Jan 25, 2001 9:13 am; Comment #1) --
<pre>
> The only problem is here that the travesal is actually happening, for
> each element in the url. It would be nice to simply the traversal at the
> first chance...
</pre>
Hmm, perhaps what you want is to hook the publishing traversal instead?
See the "Interfaces wiki writeup":/Members/michel/Projects/Interfaces/BeforePublishingTraverse.