On Thu, Feb 11, 2016 at 1:31 PM, Bastien Sevajol <[email protected]>
wrote:

>
>
> So i add this to fix it:
>     def after_init_config(self, conf):
>         self._my_stuff_for_auth(conf)
>         self.auth_backend = conf.auth_backend
>
> I make a wrong usage of conf or tg2 problem ?
>

Sadly that's currently the known behaviour of the configuration process.

While the configuration is always guaranteed to be the merged result from
the AppConfig and from the .ini files (unless you modify it, in that case
you must sync it youself) there are some configuration steps that read the
options from the AppConfig instead of reading them from the ini files for
backward compatibility reasons.

Changes in 2.3.5 finally made tg.config (the configuration) consistent, so
we can finally start reading options from there always and provide a
consistent behaviour, but this change has always been postponed because it
would break backward compatibility for anyone who changed state of options
read from AppConfig like you are doing for auth_backend.

The proper behaviour would be to read conf['auth_backend'] instead of
self.auth_backend as you would expect, the issue is that making that change
would break many people code (yours for example)  and so it's something has
been happening a little by little.

The objective is to achieve that "configure_" steps can read/write from
AppConfig, while "setup_" and "add_" steps can only read/write from the
configuration.
While some steps have already been modified to follow this rule
(setup_persistence, setup_sqlalchemy, and so on...) some like (setup_auth)
still read from AppConfig. This is something I'm changing little by little
to avoid breaking too many things at the same time to users.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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 https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to