In the pyramid.authentication.SessionAuthenticationPolicy (or
AuthTktAuthenticationPolicy) class description there is constructor
argument ``callback``. One of ``callback`` arguments is `userid`.
What exactly `userid` is? As I've found from the sources, it's a value
that passed to pyramid.security.remember, but in that method argument
is named "principal".
Moreover, I can pass to pyramid.security.remember not string but
object (sqlalchemy model for example) and everything is working just
fine (stored in the session).
So maybe developers should rename "userid" to "principal"?
And another question. What's the recommended way to store sqlalchemy
model instance in the session that represents current user? I don't
want to query database every HTTP request to obtain "user" object by
it's uid stored as ``principal`` value.
--
Sergei Stolyarov
- C
On Fri, Aug 12, 2011 at 1:38 AM, Jason <ja...@deadtreepages.com> wrote:
> Actually I misunderstood your post, but perhaps you could use a similar
> pattern for saving it in the session instead of the request?
--
Sergei Stolyarov