1. Ralph Bean
  2. tg-dev


percious  committed a65bb86 Merge

fixed beaker session bug bug.

  • Participants
  • Parent commits 65959a1, c19fe83
  • Branches default

Comments (0)

Files changed (2)

File tg/configuration.py

View file
  • Ignore whitespace
 log = logging.getLogger(__name__)
+class TGConfigError(Exception):pass
 class PylonsConfigWrapper(DictMixin):
     """Wrapper for the Pylons configuration.
     def setup_sa_auth_backend(self):
         """This method adds sa_auth information to the config."""
+        if 'beaker.session.secret' not in config:
+            raise TGConfigError("You must provide a value for 'beaker.session.secret'  If this is a project quickstarted with TG 2.0.2 or earlier \
+double check that you have base_config['beaker.session.secret'] = 'mysecretsecret' in your app_cfg.py file.")
         defaults = {
-                    'form_plugin': None
+                    'form_plugin': None,
+                    'cookie_secret': config['beaker.session.secret']
         # The developer must have defined a 'sa_auth' section, because
         # values such as the User, Group or Permission classes must be
         # explicitly defined.

File tg/tests/test_configuration.py

View file
  • Ignore whitespace
 from tg.configuration import AppConfig, config
 from tg.tests.base import TestWSGIController, make_app, setup_session_dir, teardown_session_dir, create_request
 def setup():
 def teardown():
 class TestAppConfig:
     def setup(self):
         self.config = AppConfig()
+        config['beaker.session.secret'] = 'some_secret'
     def test_create(self):
         self.config.paths.templates = 'template_path'
     def test_setup_sqlalchemy(self):
         config['sqlalchemy.url'] = 'sqlite://'
         class Package: