Brandon,<p>
<br />
LOL, I have felt your pain. Although powerful, creating even a medium number of
Traversers get tedious and difficult to maintain. Since creating objects
wouldn't help in my use case, my solution is centered around simple
grok.Views.<br />
<br />
It is tenatively called Traversables and basically acts as a named view
dispatcher. I use it to pull in objects from various parts of the database to
assemble on landing pages and to create urls without creating persistent
objects.<br />
<br />
    import grok<br />
    from traversables import Traverser, Traversable<br />
<br />
    class App(grok.Application, grok.Container):<br />
        pass<br />
<br />
    class AppTraverse(Traverser):<br />
        grok.context(App)<br />
<br />
    class UserView(grok.View):<br />
        grok.context(Traversable)<br />
        grok.name('app::user/++subpath++') # handles /user/esmith3<br />
<br />
        def render(self):<br />
            return ' '.join(self.subpath)<br />
            # self.subpath is similar to zope2's traverse_subpath<br />       
    # it returns a list of remaining subpath elements<br></br>
            # /user/esmith3 yields ['esmith3']<br />
            # /user/grok/caveman yields ['grok', 'caveman']<br />
<br />
What if /user is visited a path without subpath elements? Like grok.Traverse <br
/>
it is handeled separately.<br />
<br />
    class UserIndex(grok.View):<br />
         grok.context(Traversable)<br />
         grok.name('app::user')  #  handles /user but not
/user/esmith3</p><p><br />     class HouseView(grok.View):<br />
         grok.context(Traversable)<br />
         grok.name('app::house/++subpath++')<br />
     <br />
         def update(self):<br />
             pass :#use update, render and template as normal<br />
<br />
<br />
Although this technique may be considered too radical, it greatly simplified the
big tangled mess that came of using grok.Traverser<br />
<br />Brandon, what I really like about your technique is that all the urls are
in one place. Very similar to Routes.<br />
<br />
AFAIK you can post something in the megrok namespace. Seems like these are good
candidates for the wiki due to their highly experimental nature.<br />
<br />
<br />
Kevin Smith<br />
<br />
<br />
<br />
<br />
Quoting Brandon Craig Rhodes &lt;brandon@rhodesmill.org&gt;:<br />
<br />
&gt; The SQL-back-ended Grok application I am writing has lots of dummy<br />
&gt; objects that &quot;live at&quot; the halfway points of various URLs. 
Writing<br />
&gt; all of them, and trying to get Traversers set up correctly to link<br />
&gt; them all together, was fun for about the first hour.  Then it's been<br />
&gt; getting less fun as I have to adjust and maintain them.<br />
&gt;<br />
&gt; So tonight I sat down and, thanks to the magic of adapter-based<br />
&gt; programming, was able to write a simple implementation of something<br />
&gt; I've, for the moment, called &quot;trails&quot;.  They let you do something
like<br />
&gt; this (let's imagine a real estate application):<br />
&gt;<br />
&gt;     import grok<br />
&gt;     from trails import TrailHead, Trail<br />
&gt;     from my_orm import User, House, Bid, HouseComment<br />
&gt;<br />
&gt;     class App(grok.Application, grok.Container):<br />
&gt;         pass<br />
&gt;<br />
&gt;     class AppTrailHead(TrailHead):<br />
&gt;         grok.context(App)<br />
&gt;         trails = [<br />
&gt;             Trail('/user/:username', User),<br />
&gt;             Trail('/house/:house_id', House),<br />
&gt;             Trail('/bid/:house_id/:username', Bid),<br />
&gt;             Trail('/comment/:comment_id', HouseComment),<br />
&gt;             ]<br />
&gt;<br />
&gt; Thanks to the magic of some Traversers and also a multiply-auto-<br />
&gt; registered TrailAbsoluteURL class (so that both traversal forward and<br />
&gt; calling view.url() on these ORM objects work), users will find that<br />
&gt; they can visit URLs like the following, and view the objects<br />
&gt; instantiated as shown on the right:<br />
&gt;<br />
&gt;    /user/esmith3               User(username='esmith3')<br />
&gt;    /house/3918                 House(house_id='3918')<br />
&gt;    /bid/3918/esmith3           Bid(house_id='3918', username='esmith3')<br
/>
&gt;    /comment/49912              Comment(comment_id='49912')<br />
&gt;<br />
&gt; Improvements upon this scheme could easily be made.  And perhaps it<br />
&gt; does something poorly that other web frameworks already have better<br />
&gt; patterns for, that we ought to copy?<br />
&gt;<br />
&gt; But, if anyone is interested, I'd love to make this available in<br />
&gt; whatever the Grok equivalent is to &quot;z3c&quot;.  Let me know.  It is
very<br />
&gt; limited at the moment, but does handle things like the above example<br />
&gt; correctly.<br />
&gt;<br />
&gt; --<br />
&gt; Brandon Craig Rhodes   brandon@rhodesmill.org   <a target="_blank"
href="http://rhodesmill.org/brandon">http://rhodesmill.org/brandon</a><br />
&gt; _______________________________________________<br />
&gt; Grok-dev mailing list<br />
&gt; Grok-dev@zope.org<br />
&gt; <a target="_blank"
href="http://mail.zope.org/mailman/listinfo/grok-dev">http://mail.zope.org/mailman/listinfo/grok-dev</a><br
/>
&gt;<br />
<br />
</p>