durusmail: quixote-users: Proposed change to _traverse
Proposed change to _traverse
2000-11-09
2000-11-09
2000-11-10
2000-11-10
Proposed change to _traverse
Greg Ward
2000-11-10
On 09 November 2000, Andrew Kuchling said:
> No, that wouldn't work.  The problem is that /process/review/300 and
> .../300/ take you to the same object and produce the same output, but
> that breaks relative URLs, since a url like HREF="summary" would go to
> process/review/summary and .../review/300/summary in the two cases.
> You could write some code to figure out the correct full URL, but it
> seems to me it's easier to just always ensure that the trailing / is
> there.

+1 from me for exactly this reason: relative URLs in the 'index()' of a
method returned by '__getname__()'.

> If the traversal is something like /review/300/sequence, then no
> trailing slash is needed, and none is added by this patch, since the
> final object is a method, not a module or an instance.

This suggests a very simple rule: after the main traversal loop, do this:

    if not iscallable(object) and url[-1] != "/":
        return response.redirect(url + "/")

Or am I missing something?

BTW, I'm also +1 on the access/__getname__ fix.  My bad.  Oops.

        Greg


reply