double slash when redirecting from home to another route #213

Closed
mitechie opened this Issue Jun 18, 2011 · 3 comments

Comments

Projects
None yet
2 participants
@mitechie

I redirect / to /recent in my app. When I do the redirect using HTTPFound I end up with a double slash in the url: http://bmark.us//recent

# routes
config.add_route("home", "/")
config.add_route("bmark_recent", "/recent")

# and the view for home
@view_config(route_name="home")
def home(request):
    return HTTPFound(location=request.route_url("bmark_recent"))

If I remove the front slash from recent and change the route to

config.add_route("bmark_recent", "recent")

I don't get it.

@mcdonc

This comment has been minimized.

Show comment Hide comment
@mcdonc

mcdonc Jun 26, 2011

Member

I can't replicate this in a standalone app:

from paste.httpserver import serve
from pyramid.config import Configurator
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from pyramid.response import Response

@view_config(route_name='home')
def home(request):
    return HTTPFound(location=request.route_url('bmark_recent'))

@view_config(route_name='bmark_recent')
def recent(request):
    return Response(request.url)

if __name__ == '__main__':
    config = Configurator()
    config.add_route('home', '/')
    config.add_route('bmark_recent', '/recent')
    config.scan('__main__')
    serve(config.make_wsgi_app())
Member

mcdonc commented Jun 26, 2011

I can't replicate this in a standalone app:

from paste.httpserver import serve
from pyramid.config import Configurator
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from pyramid.response import Response

@view_config(route_name='home')
def home(request):
    return HTTPFound(location=request.route_url('bmark_recent'))

@view_config(route_name='bmark_recent')
def recent(request):
    return Response(request.url)

if __name__ == '__main__':
    config = Configurator()
    config.add_route('home', '/')
    config.add_route('bmark_recent', '/recent')
    config.scan('__main__')
    serve(config.make_wsgi_app())

mcdonc added a commit that referenced this issue Jun 26, 2011

@mcdonc

This comment has been minimized.

Show comment Hide comment
@mcdonc

mcdonc Jul 1, 2011

Member

Any news trying to repeat this?

Member

mcdonc commented Jul 1, 2011

Any news trying to repeat this?

@mcdonc

This comment has been minimized.

Show comment Hide comment
@mcdonc

mcdonc Jul 10, 2011

Member

Closing.

Member

mcdonc commented Jul 10, 2011

Closing.

@mcdonc mcdonc closed this Jul 10, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment