[Grok-dev] should I submit prototype "trails" helper?

Kevin Teague kevin at bud.ca
Fri Sep 21 02:16:09 EDT 2007


There is something to be said for stating all of your applications  
URLs in one place (it's also an easier system to wrap your head  
around than traditional Zope traversal). Especially if your app is  
not ZODB-backed. It's also very cool that the Zope component  
architecture makes it possible to choose or implement your own URL  
mapper at any level in the hierarchy of your app.

Tthe Django URL Dispatch method is fairly similar to the Trails  
approach if you've not already looked at it. The ability for Django  
URL patterns to include other patterns is also quite nice:


Pylons uses Routes, a port of the Ruby on Rails URL mapper:


Routes would probably feel weird with Grok, since what we call Views  
is analogous to their Controllers, and they also have Actions which  
are used to map to individual methods within a Controller Class. You  
could take controller and action arguments in Routes and do component  
lookup to get the correct View:

m = Mapper()
m.connect('article', 'article/:id', controller='Article', action='view')

This would then find the View with:

component.getAdapter(IBrowserRequest, IArticle, 'view')

Trying to fit Routes into the Zope component architecture would have  
a frankenstein feel to it though, components with different names  
with largely overlapping concerns in one system just bends ones noodle.

More information about the Grok-dev mailing list