def save_auth_tokens(token_dict, user=None):
 if (user is None):
  user = users.get_current_user()
 if (user is None):
  return None
 memcache.set(('gdata_pickled_tokens:%s' % user), pickle.dumps(token_dict))
 user_tokens = TokenCollection.all().filter('user =', user).get()
 if user_tokens:
  user_tokens.pickled_tokens = pickle.dumps(token_dict)
  return user_tokens.put()
 else:
  user_tokens = TokenCollection(user=user, pickled_tokens=pickle.dumps(token_dict))
  return user_tokens.put()

def save_auth_tokens ( token_dict , user = None ) : if ( user is None ) : user = users . get_current_user ( ) if ( user is None ) : return None memcache . set ( ( 'gdata_pickled_tokens:%s' % user ) , pickle . dumps ( token_dict ) ) user_tokens = TokenCollection . all ( ) . filter ( 'user =' , user ) . get ( ) if user_tokens : user_tokens . pickled_tokens = pickle . dumps ( token_dict ) return user_tokens . put ( ) else : user_tokens = TokenCollection ( user = user , pickled_tokens = pickle . dumps ( token_dict ) ) return user_tokens . put ( )
associates the tokens with the current user and writes to the datastore .