I tried to tackle this yesterday night, but as soon as I made part of the configuration process idempotent things started collapsing due to the global nature of the config object. Changing the configuration process to use self instead of tg.config to read/set values started to make multiple tests fail, it looks like some tests were working only because previous tests changed tg.config globally.
On Wed, Jun 12, 2013 at 6:25 PM, Alessandro Molina < [email protected]> wrote: > I think that the issue is that configuration process should be idempotent, > there are various cases in which this is not the true, but we should > probably clean them to make avoid having AppConfig edit the configuration. > > Probably changing > auth_args = copy(self.sa_auth) > to a deepcopy might solve the issue by making so that the original > authenticators list is not modified, but instead a copy of it is modified, > so that calling again the configuration process leads to the same result. > > I didn't actually try it, so I might be wrong, but I feel that the right > solution should be making the config process idempotent :D > > > > On Wed, Jun 12, 2013 at 5:51 PM, Christoph Zwerschke <[email protected]>wrote: > >> 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 >> turbogears-trunk+unsubscribe@**googlegroups.com<turbogears-trunk%[email protected]> >> . >> To post to this group, send email to >> turbogears-trunk@googlegroups.**com<[email protected]> >> . >> Visit this group at http://groups.google.com/** >> group/turbogears-trunk?hl=en<http://groups.google.com/group/turbogears-trunk?hl=en> >> . >> For more options, visit >> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> . >> >> >> > -- 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. For more options, visit https://groups.google.com/groups/opt_out.
