开发者

Why cant map the url to my request handler

('/\d+\?fmt=json',JsonHandler)

class JsonHandler(webapp.RequestHandler):
def get(self):
    self.response.out.write("hello"开发者_运维技巧)

Hey, I am using google app engine python and tring to map the url to my request handler. The url is digits followed by ?fmt=json, but it just doesnt print out "hello" and the regex test returns true, say 1234?fmt=json. any help? thank you


You shouldn't include the query parameter in the regex.

('/\d+',JsonHandler)

class JsonHandler(webapp.RequestHandler): 
  def get(self):
    if self.request.get("fmt") == "json": #check the query string in the get handler
      self.response.out.write("hello")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜