[Grok-dev] Re: Cancel button in forms

Brandon Craig Rhodes brandon at rhodesmill.org
Mon May 5 13:04:01 EDT 2008

Martijn Faassen <faassen at startifact.com> writes:

> Brandon Craig Rhodes wrote:
>> Given that redirection, by definition, is always to a URL, could we
>> improve self.redirect() so that it always attempts to adapt its
>> argument to a URL?
> I think the task of redirection and the task of generating a URL are
> quite different...

My point was not about what redirection should do, but about the kind
of argument that redirect() can accept.  It is my belief that the
*target* of a redirection *must* always be a URL.  (I could easily be
wrong about this; but if I am, then please point out why.)  In which
case, the redirect() method as it stands today is incorrect and
unsafe, because it does not attempt to adapt its argument to the

If we have an interface-marker that says "this thing is a URL" (and we
do), then redirect(), since it needs a URL, ought simply on principle
to make sure its arguments gets adapted to AbsoluteURL.  This has
nothing to do, in my view, with adding "magic"; it simply has to do
with the fact that, per everything from Design Patterns in 1995 on
down to PvW's own book about Zope 3, if you're going to live inside of
an adapter framework, then framework functions need to insist that
their arguments be adapted to appropriate interfaces before attempting
to use them.

This blunt writing-like-a-German stuff is fun.  Technical arguments
come out so much more cleanly!

Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon

More information about the Grok-dev mailing list