Christoph Zwerschke
unread,Jun 12, 2013, 11:51:19 AM6/12/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TurboGears Trunk
I have just run into an ugly problem with TG 2.2.2 that you can
reproduce as follows:
* Quickstart a project
* Set in config/app_cfg.py:
base_config.sa_auth.authenticators = [('default', None)]
* Run paster setup-app
* Run nosestests
You get this error:
app = setup_auth(app, skip_authentication=skip_authentication,
**auth_args)
File "...\tg\configuration\auth.py", line 227, in setup_auth
return _AuthenticationForgerMiddleware(app, **who_args)
TypeError: __init__() got an unexpected keyword argument 'dbsession'
I think the problem is this:
When running the test, the app is configured with the same config object
multiple times. In the first run, in add_auth_middleware, the sqlauth
authenticator is created using create_default_authenticator(). In this
process, the "dbsession" parameter is removed from auth_args.
However, in the second run, the sqlauth authenticator is already setup
in the configuration, create_default_authenticator() will not be
executed, the "dbsession" parameter is not removed, and finally the
_AuthenticationForgerMiddleware will be called with that parameter which
it does not want to have.
The easiest way to fix this is to let _AuthenticationForgerMiddleware
ignore superfluous arguments. Any better ideas?
-- Christoph