Need help with URL handling syntax

144 views
Skip to first unread message

Dexter

unread,
Aug 22, 2012, 9:15:32 AM8/22/12
to we...@googlegroups.com
Can any one plz tell me the difference between the two links

urls = (
    'appx/(.+)',                           'foo1',
    'appy/(.*)',                            'foo2'
)

class foo1:
    def GET(self,name):
        #Some code
        return

As much as I can dig from the documentation ... each ( ) can handle a variable
for eg appx/Bob will populate name with with Bob

how do (.+) and (.*) differ in behaviour

Cheers
PK

Michael Diamond

unread,
Aug 22, 2012, 12:22:48 PM8/22/12
to we...@googlegroups.com
These are standard regular expressions ( http://docs.python.org/library/re.html ) where . means "any one character", + means "one or more", and * means "zero or more" - so the first will match any URL that has one or more characters after the / while the second will additionally match the URL "appy/" with nothing after the slash.  In that case, the empty string "" will be passed to foo1.GET()

Michael


--
You received this message because you are subscribed to the Google Groups "web.py" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webpy/-/hD8-pnnJBtoJ.
To post to this group, send email to we...@googlegroups.com.
To unsubscribe from this group, send email to webpy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webpy?hl=en.

Dexter

unread,
Aug 24, 2012, 5:29:20 PM8/24/12
to we...@googlegroups.com
Thanks ... that does it for me :)

Cheers
PK

phc

unread,
Sep 8, 2012, 5:56:09 AM9/8/12
to we...@googlegroups.com
what is your issue? i spent long time to make my regex works or
understand how apache and lighttp work in fastcgi or wsgi mod.
so if i can help...

2012/8/24 Dexter <sci....@gmail.com>:
> Thanks ... that does it for me :)
>
> Cheers
> PK
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/webpy/-/aGVcVSAzjS8J.
> To post to this group, send email to we...@googlegroups.com.
> To unsubscribe from this group, send email to
> webpy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.



--
Philippe Colzy

Pradeep kumar Podal

unread,
Sep 8, 2012, 6:16:12 AM9/8/12
to we...@googlegroups.com
Thanks Phc ...  I just wanted some generic info ... my issues solved

Thanks Again

Cheers
- PK
Reply all
Reply to author
Forward
0 new messages