Reputation: 7110
Currently I have foo.com/bar routing to a request handler Main. I also want foo.com/bar/id to route to that request handler (where "id" is an id of an object).
Here's what I tried but it's failing:
application = webapp.WSGIApplication(
[('/bar', MainHandler),
(r'/bar/(.*)', MainHandler)],
debug=True)
The error I get is:
TypeError: get() takes exactly 1 argument (2 given)
Upvotes: 0
Views: 356
Reputation: 13117
You need to change the signature of your MainHandler.get
method, like so:
class MainHandler(webapp.RequestHandler):
def get(self, bar_id=None):
if bar_id is None:
# Handle /bar requests
else:
# Handle /bar/whatever requests
Upvotes: 2