[Grok-dev] Re: Cancel button in forms

Leonardo Rochael Almeida leorochael at gmail.com
Mon May 5 10:03:04 EDT 2008


This was supposed to go to the whole list, but was sent only to Jan
first. Sorry, Jan

On Mon, May 5, 2008 at 10:49 AM, Jan-Wijbrand Kolman
<janwijbrand at gmail.com> wrote:
> Brandon Craig Rhodes wrote:
>>
>> [...]
>>
>> I get tired of writing self.redirect(self.url(...)).  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?
>
>
> What does "adapt its arguments to a URL" mean? You should be able to
> redirect to *any* URL, not just ones that are "creatable" through
> view.url().

I think he means a slight DWIM: if the argument is a string, it's the
url meant to be redirected to. If it's not a string (including if the
argument is not present), treat the argument as the argument to
self.url(), and redirect to that instead.

There is a catch to that, however: self.url() does accept strings as
arguments. so the DWIM would have to be expanded to check if the
string argument is already a URL or not...

Maybe a self.urlredirect() method? (by any other rose... I mean, name).

Cheers, Leo


More information about the Grok-dev mailing list