Simple URL question

15 views
Skip to first unread message

tmallen

unread,
Oct 27, 2008, 11:54:41 AM10/27/08
to web.py
Instead of

urls = (
"/", "index",
"", "index"
)

this

urls = (
"/?" "index"
)

works fine. So I find myself prefixing all of my URL keys with /? to
cover both with and without the slash. Is this really necessary? In my
testing, I only ran into problems when I left out the first "/" case.

Brent Pedersen

unread,
Oct 27, 2008, 12:22:21 PM10/27/08
to we...@googlegroups.com
hi, i use this:
http://pastebin.ca/1237881

so it will go through the urls and if it doesnt find a match and it
doesnt end with '/'
it will try to match again with '/' appended.

-b

tmallen

unread,
Oct 27, 2008, 1:03:45 PM10/27/08
to web.py
Cool, thanks for the snippet.

On Oct 27, 12:22 pm, "Brent Pedersen" <bpede...@gmail.com> wrote:
> hi, i use this:http://pastebin.ca/1237881
>
> so it will go through the urls and if it doesnt find a match and it
> doesnt end with '/'
> it will try to match again with '/' appended.
>
> -b
>

Hraban Luyat

unread,
Oct 27, 2008, 2:49:49 PM10/27/08
to we...@googlegroups.com

Hmm, what do you do to make an empty request like that? I would like to
see the headers that make that work..

tmallen

unread,
Oct 27, 2008, 3:06:42 PM10/27/08
to web.py
I don't know how to do that. I just based my URLs on the example on
the tutorial:

urls = (
'/', 'index',
'', 'index' )


Hraban Luyat

unread,
Oct 27, 2008, 4:42:17 PM10/27/08
to we...@googlegroups.com

Hey, you're right. I never noticed that part as such... why is it there?
When and how do you ever get an empty request? Does anybody know...? It
seems to have been added september the 18th:
<http://webpy.org/tutorial2.en?b=38&a=37&m=diff>.

Reply all
Reply to author
Forward
0 new messages