On Tue, Aug 17, 2010 at 9:16 AM, Wouter Van Hemel
<[email protected]> wrote:
> Hello,
>
> I'm new to Pylons. In the Forms section of the 1.0 documentation on
> the Pylons website we're given the following example:
>
> def email(self):
>    # Code to perform some action based on the form data
>    # ...
>    redirect(url(action='result'))
>
>
>
> ... but in a default 1.0 installation, the 'url' function takes me to
> /content/result (which doesn't exist) instead of /hello/result. I
> didn't touch config/routing.py; it still says:
>
>    map.minimization = False
>    map.explicit = False
>
>
> Should I use url.current() here instead?
>
> And how do I change this default '/content/' controller to point to
> '/non-existent/' or something similar – where is it defined?

That example is taking more shortcuts than it should, and may be a
leftover from an older version of Pylons. If you're using the default
"/{controller}/{action}" route, always specify both a controller and
an action.

redirect(url(controller="hello", action="result"))

"/content/" is probably a default somewhere in Routes or Pylons, but
you shouldn't depend on it as it's likely to go away sometime.

A robust application (as opposed to a quick ad hoc application) should
have a specific named route for each URL, and then use
``redirect(url("routename"))``.

The current application template has "map.minimization = False" and
"map.explicit = False", as you have. I'm not 100% sure about
map.explicit, it's name seems to be the opposite of its description in
the docs. I.e., my reading of the docs is that ``map.explicit`` really
does ``map.implicit``?
(http://routes.groovie.org/uni_redirect_rest.html#backward-compatibility)
 In any case, just leave them as False, and always specify a
controller either in the route definition or in the url() call.

-- 
Mike Orr <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to