Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
Break get_or_create out into two.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jan 15, 2014
1 parent 7a0acb0 commit 7e3d482
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fmn/lib/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,14 @@ def all(cls, session):
def get_or_create(cls, session, openid, openid_url):
user = cls.by_openid(session, openid)
if not user:
user = cls(openid=openid, openid_url=openid_url)
session.add(user)
session.flush()
user = cls.create(session, openid, openid_url)
return user

@classmethod
def create(cls, session, openid, openid_url):
user = cls(openid=openid, openid_url=openid_url)
session.add(user)
session.flush()
return user


Expand Down

0 comments on commit 7e3d482

Please sign in to comment.