Tres Seaver
2009-11-05 e0d13818dc090a505b5e8688ec844a4105a97a7d
Fixed the ``repoze.who.plugins.form.make_plugin`` factory's ``formcallable``
argument handling, to allow passing in a dotted name (e.g., from a config
file).

3 files modified
22 ■■■■ changed files
CHANGES.txt 7 ●●●●● patch | view | raw | blame | history
repoze/who/plugins/form.py 3 ●●●●● patch | view | raw | blame | history
repoze/who/plugins/tests/test_form.py 12 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -1,6 +1,13 @@
repoze.who Changelog
====================
After 1.0.16
------------
- Fixed the ``repoze.who.plugins.form.make_plugin`` factory's ``formcallable``
  argument handling, to allow passing in a dotted name (e.g., from a config
  file).
1.0.16 (2009-11-04)
-------------------
repoze/who/plugins/form.py
@@ -16,6 +16,7 @@
from zope.interface import implements
from repoze.who.config import _resolve
from repoze.who.interfaces import IChallenger
from repoze.who.interfaces import IIdentifier
@@ -216,6 +217,8 @@
            'must include rememberer key (name of another IIdentifier plugin)')
    if form is not None:
        form = open(form).read()
    if isinstance(formcallable, str):
        formcallable = _resolve(formcallable)
    plugin = FormPlugin(login_form_qs, rememberer_name, form, formcallable)
    return plugin
repoze/who/plugins/tests/test_form.py
@@ -208,10 +208,14 @@
        self.assertEqual(plugin.formcallable, None)
    def test_with_formcallable(self):
        def _callable(environ):
            return {'foo': 'bar'}
        plugin = self._callFUT('__login', 'cookie', formcallable=_callable)
        self.assertEqual(plugin.formcallable, _callable)
        dotted='repoze.who.plugins.tests.test_form:sample_formcallable'
        plugin = self._callFUT('__login', 'cookie',
                               formcallable=dotted
                               )
        self.assertEqual(plugin.formcallable, sample_formcallable)
def sample_formcallable(environ):
    return {'foo': 'bar'}
class TestRedirectingFormPlugin(unittest.TestCase):