Skip to content

Commit

Permalink
Fix anon user get_or_insert.
Browse files Browse the repository at this point in the history
  • Loading branch information
moowiz committed Sep 16, 2014
1 parent a0ca1a3 commit eb6367c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit eb6367c

Please sign in to comment.