Exemple #1
0
         logging.error('Failed to save user data: %s' % e)
         raise
     except:
         logging.error("Unexpected error while creating user")
         exception = sys.exc_info()[0]
         logging.exception(exception)
         raise
     else:
         logging.debug('got user[created: %s]: %s' % (created,user.username))
         friends = friends_get(xn)
         logging.debug('got friends: %s' % friends)
         user.friends_uids = friends if friends else []
         user.put()
         #inc user counters
         if user.sex == 1:
             change_count(COUNTER_MALES,1)
         else:
             change_count(COUNTER_FEMALES,1)
         #inc age counters
         logging.debug('+1 for birth year %s' % user.birth_year)
         change_count(COUNTER_YEAR_PRE+user.birth_year,1)
 else:
     logging.debug(u'got user: %s' % user)
     if not user.friends_uids:
         logging.debug('no friends found, getting friends again')
         friends = friends_get(xn)
         logging.debug('got friends: %s' % friends)
         user.friends_uids = friends if friends else []
         user.put()
 memcache.set(xn.uid, user, SECS_DAY)
 logging.debug('user added to memcache')