[Grok-dev] Custom traverse method for application not working

Brandon Craig Rhodes brandon at rhodesmill.org
Sat Jul 19 18:51:52 EDT 2008

Achim Domma <domma at procoders.net> writes:

> I have defined an application and a model like this:
> class CodeReview(grok.Application, grok.Model):
>     def traverse(self,name):
>         return SvnFolder()
> class Index(grok.View):
>     grok.context(CodeReview)
>     pass # see app_templates/index.pt
> class SvnFolder(grok.Model):
>     pass
> As far as I understood http://grok.zope.org/documentation/developers-
> notes/, this should work. The application can be created without
> problem and the index page is displayed. But if I append something to
> the url, I get a Zope 3 error page, telling me that the page I
> requested is not available.
> What am I doing wrong?

You have neglected to provide a "grok.View" that can turn an SvnFolder
into HTML.  Try:

class SvnFolderIndex(grok.View):

... and create a template "app_templates/svnfolderindex.pt" to go with it.

Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon

More information about the Grok-dev mailing list