Bug? /(test1|test2) not working in URL path matching

7 views
Skip to first unread message

Zhang Huangbin

unread,
Jul 15, 2010, 8:46:58 AM7/15/10
to web.py
In cookbook "Understand URL handling" (http://webpy.org/cookbook/
url_handling ):

# ----
You can utilize the power of regular expressions to design more
flexible url patterns. For example, /(test1|test2) will catch either /
test1 or /test2.
# ----

But not work with webpy-0.34. Error msg:

GET() takes exactly 1 argument (2 given)

Xavier Combelle

unread,
Jul 15, 2010, 8:52:17 AM7/15/10
to we...@googlegroups.com
are you sure that your GET is at the format
class list_users:
    def GET(self, name):
        return "Listing info about user: {0}".format(name)

Anand Chitipothu

unread,
Jul 15, 2010, 9:00:25 AM7/15/10
to we...@googlegroups.com
2010/7/15 Zhang Huangbin <michae...@gmail.com>:

The regular expression groups are passed as argument to the GET
function. If you don't want that to happen, then use non grouping
version of parenthesis. For example "/(?:test1|test2).

For more details, see:
http://docs.python.org/howto/regex.html#non-capturing-and-named-groups

Anand

Zhang Huangbin

unread,
Jul 15, 2010, 9:07:57 AM7/15/10
to web.py


On Jul 15, 8:52 pm, Xavier Combelle <xavier.combe...@free.fr> wrote:
> are you sure that your GET is at the format

Oops, my stupid fault :(

Thanks Xavier & Anand. :)
Reply all
Reply to author
Forward
0 new messages