FrontPage
»
MessingWithTraversal
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.
def __bobo_traverse__(self, REQUEST, key): ''' no more traversal ''' return self
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.
def __call__(self, REQUEST): ''' do something ''' return "%s" % REQUEST{'PATH_INFO'}* replace { with [
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...
- tseaver (Jan 25, 2001 9:13 am; Comment #1)
> 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...
Hmm, perhaps what you want is to hook the publishing traversal instead? See the Interfaces wiki writeup.