This is a known issue. The fix involves special-casing (and documenting)
the inconsistent behavior. Instead we intentionally treat the
include(route_prefix=..) to indicate a "container" in which the suffixed
'/' is appropriate. Anyway I decided to document this on github rather than
fully explain it here for posterity:

https://github.com/Pylons/pyramid/issues/406

On Wed, Jan 18, 2012 at 5:53 AM, Simon Yarde <[email protected]> wrote:

> Please can we have the option to disable automatic slash for empty
> route-paths, in order for despatch-style design to be 'more modular'.
>
> Issue:
>
> - Let's say I want to exclude the '/article' prefix from the article
> module to make it 'more modular';
>
> - I use a route_prefix to add the routes from the article module;
>
> - I would like to have '/article' as the module-root, but instead I get
> '/article/' with a trailing-slash;
>
> - As a workaround I have to use an additional add_route('/article') after
> the include(), and exclude '/' root path from the module..
>
> - BUT, now I can't use a nice includeme method within my module to keep
> all the route config self-contained, and my module isn't modular!
>
> Please note my goal is not to make a distributable module, but rather to
> keep my code neat and logical.
>
>
> # article/__init__.py
> def routes(config):
>    config.add_route('article_list', '')
>    config.add_route('article_item', '/{id}')
>
>
> # __init__.py
> ...
> config.include('article.routes', route_prefix='/article}')
>
>
> # Result:
>
> /article/
> /article/1234
>
> # More helpful result:
>
> /article                ** no trailing slash
> /article/1234
>
> --
> 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.
>
>

-- 
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