[Grok-dev] grok.traverser question

geoHUZ geohuz at gmail.com
Tue Feb 3 23:19:12 EST 2009


In the tutorial "Navigating To Transient Objects Tutorial "  there is a
following piece of code to write custom traverser,

....
traverser=BaseTraverser(grok.getSite(), None)
parent=traverser.publishTraverser(None,'natural')
...

class BaseTraverser(grok.Traverser):
       grok.context(TransientApp)
       def traverse(self,name):
              ......


looking at the code of BaseTraverser class definition, it doesn't have the
parameter "None". I checked the grok reference, it says:

grok.Traverser¶

A Traverser is used to map from a URL to an object being published (Model)
and the View used to interact with that object.

class grok.Traverser¶

    Base class for custom traversers. Override the traverse method to supply
the desired custom traversal behaviour.

    context¶
        The object that is being traversed.

    request¶

I'm not sure if the class definition part should be
grok.Traverser(context,request), then the example code has
context=getSite(), request=None. Could somebody give me a clue on this? And
I also want to know what exactly means when request=None. I've also checked
the index part of the grok documentation, there is an item named:
grok.Traverser (class in None), could somebody tell me what does that mean?
-- 
View this message in context: http://www.nabble.com/grok.traverser-question-tp21824227p21824227.html
Sent from the Grok mailing list archive at Nabble.com.



More information about the Grok-dev mailing list