web.application .32 line 232:
fn, args = self._match(self.mapping, web.ctx.path) line 427: _match() adds ^ and $ respectively to each end of the URI pattern So its trying to match your updated pattern against web.ctx.path. <[email protected]> wrote: > > Thank you for the info, but, that's not my problem I know how to make > urls with or without "/" work :) I just need to know how the regex > matching is done, in detail, so that I can handle more complex cases > in the future. > > On Nov 8, 7:03 pm, Alessandro Agosto <[email protected]> wrote: > > On Nov 8, 9:35 am, xrfang <[email protected]> wrote: > > > > > I have the following code in my index.py > > > > > urls = ( > > > "/tasks/?$", "signin", > > > "/tasks/list", "listing", > > > "/tasks/post", "post", > > > ... ... > > > ) > > > > > Now having a problem I am debugging, the question I am asking now is > > > related to the problem. Please see the first line: "/tasks/?$" ... My > > > intention is to let it match either of the following > > > > >http://localhost/taskshttp://localhost/tasks/ > > > > > I found, if I write "/tasks", then it won't work, because the browser > > > (or nginx) always send webpy the urlhttp://localhost/tasks/, even if > > > I type in "http://localhost/tasks" (without the /). > > > > > Now I started to wonder, shall I put $ at the end of the regex? I did > > > that, it is still correct even for urls like: > http://localhost/tasks/?msg=Invalid%20username%20or%20password > > > > > In another word: regex matching is AFTER urlcracking, i.e., only the > > > PATH is being matched and parameters of the url is stripped off, > > > right? Which is to say, the regex we write in url() block is ALWAYS a > > > full-match and there is no need to write ^ or $? > > > > > I think it is full match, because, if it is not, then url like /tasks/ > > > blahblah will also be matched my the first item? > > > > > Could you please help me confirm this? > > > > > Thank you! > > > > Hi, > > have you seen the "Hello World" tutorial? (http://webpy.org/cookbook/ > > helloworld) > > The author discussed how to make a redirect to make urls with a slash > > working. > > So if your app receive a request tohttp://www.example.com/tasks/ > > redirect to the url /tasks. I'm using this solution without any > > problem. > > Regarding the URLs question, please wait someone who can respond with > > certainty. > > Greetings, > > Alessandro. > > > -- Angelo Gladding [email protected] http://angelo.gladding.name/ E69E 47E8 5C3A 96E5 C70F D931 F35C ACBA 6F39 9611 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
