If you do it properly, you can .get(primary_key) the user from the
SQLAlchemy session and it only hits the storage once per transaction. If the
object hasn't been garbage collected, subsequent .get() calls will hit the
identity map, which can be used as a kind of cache but which is really there
http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/authentication.html
may help.
- C
On Tue, 2011-02-22 at 09:12 +, Chris Withers wrote:
> Hi All,
>
> Suppose I have a user object that behaves something like:
>
> class User:
>
>def __init__(self,name,password):
> self.n
On 2/22/11 10:12 , Chris Withers wrote:
Hi All,
Suppose I have a user object that behaves something like:
class User:
def __init__(self,name,password):
self.name,self.password = name,password
def authenticate(self,password):
return self.password==password
def allowed(self,permission):
... st
On Feb 22, 2011, at 12:12 PM, Chris Withers wrote:
> If, say, I instantiate this user in the authentication middlewear, where's
> there "right" place to put this user object so that I don't have to
> instantiate it again when I need it for the authentication and authorization
> policies?
You c
Hi All,
Suppose I have a user object that behaves something like:
class User:
def __init__(self,name,password):
self.name,self.password = name,password
def authenticate(self,password):
return self.password==password
def allowed(self,permission):
... stuff ...
Now, for the s