Sunday, February 26, 2012

question about "\d" in url pattern

url(r'^friend_page/cheer/confirm/(?P<fid>\w+)/(?P<key>\d+)/(?P<point>\d+)/$', 'cheer_confirm', name = 'friend_page'),

def cheer_confirm(request, fid, key, point):
    data = {
            'point'     : 10 + point,
            }
    ...

i got 
TypeError: unsupported operand type(s) for +: 'int' and 'unicode'

i did "print type(point)", and got type(unicode)
apparently, point is not int.

i thought "\d+" in url promises i can get an int point in cheer_confirm, and am i wrong?

No comments:

Post a Comment