Skip to content

Commit

Permalink
Remove language default value in TGApp
Browse files Browse the repository at this point in the history
As it is now set by config defaults it can be removed from TGApp,
the testsuite needs to be updated to cope with the change and a
new test to check that is possible to set language from .ini files
is added
  • Loading branch information
amol- committed Jun 1, 2013
1 parent aa580d4 commit 7c83c4f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ def test_get_root(self):
assert self.config.get_root_module() == None, self.config.get_root_module()
self.config['paths']['root'] = current_root_module

def test_lang_can_be_changed_by_ini(self):
conf = AppConfig(minimal=True)
conf.init_config({'lang':'ru'}, {})
assert config['lang'] == 'ru'

def test_create_minimal_app(self):
class RootController(TGController):
@expose()
Expand Down
3 changes: 2 additions & 1 deletion tests/test_stack/baseutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class FakePackage(object):
'renderers': ['json'],
'render_functions':{'json':tg.render.render_json},
'use_legacy_renderers':False,
'use_sqlalchemy': False
'use_sqlalchemy': False,
'lang': None
}

class FakeRoutes(object):
Expand Down
1 change: 0 additions & 1 deletion tg/configuration/app_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def __init__(self, minimal=False, root_controller=None):
self.handle_error_page = not minimal

self.use_sessions = not minimal

self.i18n_enabled = not minimal
self.serve_static = not minimal

Expand Down
7 changes: 2 additions & 5 deletions tg/wsgiapp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os, sys, logging, paste
from webob.exc import HTTPFound, HTTPNotFound
import os, sys, logging
from webob.exc import HTTPNotFound

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -61,9 +61,6 @@ def __init__(self, config=None, **kwargs):
self.controller_classes = {}
self.controller_instances = {}

#This is here just as a safety net as AppConfig already sets it
self.config.setdefault('lang', None)

# Cache some options for use during requests
self.strict_tmpl_context = self.config['tg.strict_tmpl_context']
self.pylons_compatible = self.config.get('tg.pylons_compatible', True)
Expand Down

0 comments on commit 7c83c4f

Please sign in to comment.