Hey,
I would like to pass the skip_authentication parameter using the config
file with repoze.what-quickstart plugin.
I've attached a patch with this feature, if anyone wants to review it
and perhaps it could be included in the next release :)
Any feedback?
Néstor.
Index: tests/fixture/skip-authentication-config.ini
===
--- tests/fixture/skip-authentication-config.ini (revision 0)
+++ tests/fixture/skip-authentication-config.ini (revision 0)
@@ -0,0 +1,13 @@
+# Sample configuration file for repoze.what-quickstart.
+# This file uses only the mandatory options and they are all valid.
+
+[general]
+dbsession = tests.fixture.model:DBSession
+
+[authentication]
+user_class = tests.fixture.model:User
+skip_authentication = True
+
+[authorization]
+group_class = tests.fixture.model:Group
+permission_class = tests.fixture.model:Permission
Index: tests/test_config.py
===
--- tests/test_config.py (revision 9334)
+++ tests/test_config.py (working copy)
@@ -24,6 +24,7 @@
from repoze.who.plugins.sa import SQLAlchemyAuthenticatorPlugin, \
SQLAlchemyUserMDPlugin
from repoze.who.plugins.friendlyform import FriendlyFormPlugin
+from repoze.who.plugins.testutil import AuthenticationForgerMiddleware
from repoze.what.middleware import AuthorizationMetadata
from repoze.what.plugins.quickstart import (add_auth_from_config,
@@ -229,6 +230,11 @@
handler = app.logger.handlers[0]
self.assertEqual(handler.stream.name,
os.path.join(FIXTURE_DIR, "file.log"))
+
+def test_skip_authentication_config(self):
+"""A config file with skip authentication options."""
+app = make_app("skip-authentication-config")
+self.assertEqual(AuthenticationForgerMiddleware, type(app))
def test_missing_options(self):
"""Configuration files with missing mandatory options."""
Index: repoze/what/plugins/quickstart/config.py
===
--- repoze/what/plugins/quickstart/config.py (revision 9334)
+++ repoze/what/plugins/quickstart/config.py (working copy)
@@ -150,7 +150,8 @@
self._add_string("authentication", "login_counter_name")
self._add_string("authentication", "log_level")
self._add_string("authentication", "log_file")
-
+self._add_boolean("authentication", "skip_authentication")
+
# Adding authorization options:
self._add_object("authorization", "group_class")
self._add_object("authorization", "permission_class")
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev