Hi,
I add precision about my just recent experience with overriding
after_init_config:
I override after_init_config to populate config.sa_auth values and set
config.auth_backend value (database auth or ldap auth depending on conf.ini
setting). But, when AppConfig check his auth_backend value:
if self.auth_backend:
# Skipping authentication if explicitly requested.
# Used by repoze.who-testutil:
skip_authentication = app_conf.get('skip_authentication', False)
app = self.add_auth_middleware(app, skip_authentication)
self.auth_backend is None. Even if i modify auth_backend key in config dict.
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 ?
Le lundi 8 février 2016 17:56:14 UTC+1, Alessandro Molina a écrit :
>
> Yes,
>
> Inherit you AppConfig and provide an after_init_config(self, conf) method
> it will receive the configuration after it got loaded from development.ini
> and merged with app_cfg.py. There you can change it the way you prefer
> before it's actually processed.
>
> On Mon, Feb 8, 2016 at 12:03 PM, Bastien Sevajol <[email protected]
> <javascript:>> wrote:
>
>> Hi,
>>
>> Related to this topic
>> <https://groups.google.com/forum/#!searchin/turbogears/read$20ini$20in$20app_cfg/turbogears/tAzc7SDPuV4/QrwrkLbP41QJ>i
>>
>> would like to read development.ini values in app_cfg.py file. Typically to
>> propose simple configuration choice / deployment. Like:
>>
>> [app:main]
>> # You can choice between "internal" authentication or "ldap"
>> authentication:
>> auth = internal
>>
>> Then app_cfg.py config will be construct depending of auth value.
>>
>> Is it possible ?
>>
>> Thank's !
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/turbogears.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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.