Cache named profiles in memory in the Python application, since they're immutable once written.

This commit is contained in:
Ian Gulliver
2014-06-07 23:06:17 -07:00
parent 66e68ea8dd
commit 1b4b55ac23
2 changed files with 16 additions and 5 deletions

View File

@@ -23,11 +23,7 @@ from cosmopolite.lib import models
def CreateClientAndProfile(client_id, google_user):
if google_user:
# We're going to need a profile for this user regardless
profile = models.Profile.get_by_key_name(google_user.user_id())
if not profile:
profile = models.Profile(
key_name=google_user.user_id(), google_user=google_user)
profile.put()
profile = models.Profile.FindOrCreate(google_user)
else:
profile = None