-----BEGIN PGP SIGNED MESSAGE-----
Raphael Slinckx wrote:
> New submission from Raphael Slinckx <r.slin...@whatever-company.com>:
> I can't find a way to setup identity programmatically.
> I have a registration controller that creates a user in a database, when the
> registration controller returns I want the user to be authenticated just like
> would have logged-in through the login form.
> It seems repoze.who doens't allow to programmatically set identity from python
> code inside a request, and thus the auth cookie isn't sent back from the
> After a quick glance at the code, the identity is set to None if the user is
> anonymous, and then the remember phase of repoze is run with no identity so it
> doesn nothing, and since i can't assign an identity from my controller code,
> seems impossible.
You should be able to do this from application code by calling the
'remember' method of your "identifier" plugin. Something like (untested)::
plugins = environ['repoze.who.plugins']
identifier = plugins['<your plugin name here>']
headers = identifier.remember(environ, identity)
and then append those headers to your response. The 'identity' mapping
should have whatever keys your plugin's 'remember' method requires.
Tres Seaver +1 540-429-0999 tsea...@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Repoze-dev mailing list