2013-06-06 123 views
0

http://mysite.com/cn - OKRedirectRoute + strict_slash = KeyError异常

http://mysite.com/cn/ - 错误

KeyError异常:“缺少参数 “0” 建设URI“。

我确实只有一条路线。请帮助...

class MyHome(webapp2.RequestHandler): 
    def get(self, language='en'): 
    buf = 'hello world at %s' % (language,) 
    self.response.write(buf) 

app = webapp2.WSGIApplication([ 
    routes.DomainRoute(r'<:(localhost|mysite\.com|www\.mysite\.com)>', [ 
     routes.RedirectRoute(r'/<:(en|bm|my|cn|zh)>', handler=MyHome, strict_slash=True, name='Home'), 
    ]), 
], debug=True) 

回答

0

我想你想r'/<language:...而不是r'/<:...您的路线