2013-06-06 119 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'/<:...您的路線