pyramid_fullauth
pyramid_fullauth copied to clipboard
Document root/session factory overriding
This was something that took me quite a while to figure out since it was not obvious to me how to do it. I wanted to use my own root factory (e.g. MyRootFactory
), and the code:
# register root factory, only if not set already
if configurator.registry.queryUtility(IRootFactory) is None:
configurator.set_root_factory(
'pyramid_fullauth.auth.BaseACLRootFactoryMixin')
confused me. In the end I found out that I could do:
configurator.registry.registerUtility(MyRootFactory, IRootFactory)
to make sure my factory was used instead.
How did you indent this to be used ? I ended up doing this only since I did not find another way that worked - so I am guessing it might not be the most natural way.
Would be nice with some documentation describing this, possibly with a small example.
@Zitrax basically all of the auth factories are set only if they haven't been set already. So possibly all of that could be described.
Either that, or add the possibility to configure and extend current acl.
Just out of curiosity, what does your root factory contains?
I wanted a generic name for the 's:user' so I basically changed the ('password_change', 'email_change') to 'user'.
In addition I did not want to care about inactive vs active users at this point, so allowing 's:inactive' in addition. But that's something I'll probably change later.