Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web.seeother #311

Closed
suziguai opened this issue Nov 11, 2014 · 4 comments
Closed

web.seeother #311

suziguai opened this issue Nov 11, 2014 · 4 comments

Comments

@suziguai
Copy link

When I use the code "Basic wiki in 0.3" I get from the "http://webpy.org/src/wiki/0.3", I find when I use the method "raise web.seeother('/' + form.d.url)" in the class New in wiki ,I will go to (/new/+"url") instead of (/"url"),Why? Does the method seeother just designed for this?

@esun2
Copy link

esun2 commented Nov 12, 2014

Does the method seeother just designed for this?

It probably not, seeother will redirect you to the path of urlparse.urljoin(ctx.path, url)
'ctx.path' is the current path which should be '/new'
'url' is the URL you provided which should be '/[your url]'
join the two path should finally get '/[your url]', that's what expected to be and what i got for the same sample.

@suziguai
Copy link
Author

When I use urlparse.urljoin(ctx.path, url) I got '/[your url]', But when I put the code to my web server,it seems that it makes no effert

@esun2
Copy link

esun2 commented Nov 17, 2014

I can only reproduce your case by including "new/" in my location like if i input my location as "new/cake" then the URL of the page will be "/new/cake".
Can you try to

  1. print form.d.url just before call web.seeother
  2. try to remove '/' before form.d.url to see the result of the relative path

If above results still can't move you to the side of the answer, try pdb to see the variables value changes in your web.seeother

@lachlandcp
Copy link

The example doesn't have a trailing slash on the URL i.e '/new/', 'New',, it instead has no slash i.e '/new', 'New',, which sounds it looks like you have.

I realise this is old, though others nay have the same problem :p

@iredmail iredmail closed this as completed Jun 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants