From eb6367c867e6d38a3d738e8ea19a04545280c9a9 Mon Sep 17 00:00:00 2001 From: Stephen Martinis Date: Tue, 16 Sep 2014 14:52:55 -0700 Subject: [PATCH] Fix anon user get_or_insert. --- server/app/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/app/models.py b/server/app/models.py index a4b35c0a4..1e4981b3a 100644 --- a/server/app/models.py +++ b/server/app/models.py @@ -129,12 +129,12 @@ def from_dict(cls, values): def get_or_insert(cls, email, **kwargs): assert not isinstance(id, int), "Only string keys allowed for users" kwargs['email'] = email - return super(cls, User).get_or_insert(email, **kwargs) + return super(User, cls).get_or_insert(email, **kwargs) @classmethod def get_by_id(cls, id, **kwargs): assert not isinstance(id, int), "Only string keys allowed for users" - return super(cls, User).get_by_id(id, **kwargs) + return super(User, cls).get_by_id(id, **kwargs) @property def logged_in(self): @@ -188,6 +188,10 @@ def put(self, *args, **kwds): """ pass + @classmethod + def get_or_insert(cls, *args, **kwds): + return super(AnonymousUser, cls).get_or_insert(*args, **kwds) + AnonymousUser = AnonymousUser.get_or_insert("anon_user")