[Grok-dev] Traversing over attributes/methods in grok.View

Christian Klinger cklinger at novareto.de
Mon Sep 13 07:58:23 EDT 2010


Hello,

i try to access attributes/methods of a grok.View via traversal.
But i have no idea where to look for a solution.

Take a look at this exmaple: I think it shows what i want...


class MyView(grok.View):

     def foo(self):
         return "foo"

     def render(self):
         return "normal view"

 >>> browser.open('http://localhost/app/myview')
 >>> browser.contents
"normal view"

 >>> browser.open('http://localhost/app/myview/foo')
 >>> browser.contents
"foo"


Any idea how i can do this? I guess i have to look in zope.publication 
and or zope.traversal.

Maybe someone has an example of it?

Christian



More information about the Grok-dev mailing list