Commits

Andriy Kornatskyy committed ea07f4d

If locale is not present in routing, return an empty one.

Comments (0)

Files changed (2)

src/wheezy/web/handlers/base.py

 
     @attribute
     def locale(self):
-        return self.route_args['locale']
+        return self.route_args.get('locale', '')
 
     @attribute
     def translations(self):

src/wheezy/web/handlers/tests/test_base.py

         self.handler.route_args['locale'] = 'en'
         assert 'en' == self.handler.locale
 
+    def test_no_locale(self):
+        """ Ensure default implemenation takes locale from route_args.
+        """
+        assert '' == self.handler.locale
+
     def test_translations(self):
         """ Translations returned per current locale.
         """