On Tue, Feb 20, 2007 at 04:37:41PM +0100, Andreas Jung wrote:
> --On 20. Februar 2007 16:30:43 +0100 Gaute Amundsen <[EMAIL PROTECTED]> wrote:
> 
> >Hi.
> >
> >Normally a url to an article in our CMS system would look roughly like
> >this: http://www.dom.tld/aritcles/25245
(snip)
> >Anybody have any ideas on how this might be done?
> 
> How about Apache rewrite rules or a script called index_html that fetches
> the object by its ID? That's pretty much boring straight-forward stuff :-)

Another option is that the object at /articles could be an instance
of a class that looks something like:

class MyArticleContainer():

    def __before_publishing_traverse__(self, unused, request):
        # Save the rest of the path as 'traverse_subpath'.
        request.set('traverse_subpath',
                    reversed(request['TraversalRequestNameStack']))
        # Tell the publisher to stop traversing now.
        request['TraversalRequestNameStack'][:] = []

    def __call__(self, *args, **kw):
        subpath = self.REQUEST['traverse_subpath']
        data = get_data_however_you_like(subpath)
        return data


For background, read the stuff about traversal hooks at
http://wiki.zope.org/zope2/ZPublisher


-- 

Paul Winkler
http://www.slinkp.com
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to