Reputation: 185
Trying to implement a vote button with Ajax and jquery. I have the following handler for my upvotes
class Upvote(PageHandler):
def post(self):
logging.error("1")
And my upvote urls map to the handler like so:
app = webapp2.WSGIApplication([('/', FrontPage),
('/upvote_([0-9]+)', Upvote)
Now this is giving me the error
TypeError: post() takes exactly 1 argument (2 given)
However
app = webapp2.WSGIApplication([('/', FrontPage),
('/upvote_2', Upvote)
works fine for upvote id 2. Can someone please tell me what I am missing here? Is the regex wrong? I'm a complete rookie so sorry if the question seems too naive. Thanks.
EDIT: Changed ('/upvote_2)', Upvote) to ('/upvote_2', Upvote)
Upvotes: 4
Views: 2256
Reputation: 2628
With no knowledge of the app you are using, I assume that the regex adds captured groups (enclosed by (
)
) as arguments. Removing the parentheses could solve your problem.
Upvotes: 3