def get_user_id_for_username(user_name, allow_none=False):
 try:
  if (c.userobj and (c.userobj.name == user_name)):
   return c.userobj.id
 except TypeError:
  pass
 user = model.User.get(user_name)
 if user:
  return user.id
 if allow_none:
  return None
 raise Exception('Not logged in user')

def get_user_id_for_username ( user_name , allow_none = False ) : try : if ( c . userobj and ( c . userobj . name == user_name ) ) : return c . userobj . id except TypeError : pass user = model . User . get ( user_name ) if user : return user . id if allow_none : return None raise Exception ( 'Not logged in user' )
helper function to get user id .