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

--
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears-trunk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to