Zope2.10
Jun 02, 2007
IPublishTraverse and a Plone 3 dependency
For the past couple of days, I've been working on updating my main development branch (maurits-traversal) to be compatible with Plone 3. This means being compatible with Zope 2.10, which in turn means that I have had to change the traversal mechanism applied to URLs like "[weblog]/topics/..." over to use the new IPublishTraverse interface and design. As IPublishTraverse is not available in Zope 2.9.x, this amounts to a new hard dependency for Quills (1.6+) on Zope 2.10 - which presumably means a hard dependency on Plone 3+.
A few notes on the new IPublishTraverse mechanism are in order.
First, it took quite a long time to swap things over, although this was largely because it took me a while to figure out what I was supposed to do. Maybe there are docs, but I coudn't really find them.
Second, the IPublishTraverse is, for my purposes, not as nice as what went before. My goal was to be able to intercept all URL segments below "topics" in "[weblog]/topics/Football/Tennis/Zope", and thus get the kind of traverse_subpath behaviour that "Script (Python)" objects have. In the old setup, your traversal adapter was passed "furtherPath" as a parameter, and this would look like "['Football', 'Tennis', 'Zope']". Easy enough to intercept the rest of the path, then. In the new setup, the IPublishTraverse.publishTraverse method only gets the individual URL segments one at a time. To get around this, you have to grab hold of "request['TraversalRequestNameStack']" directly - and that feels a little bit wrong. It appears I'm not the only one who thinks this.
Ho hum, traversal (at least) seems largely to be working now.

