def convert_user_name_or_id_to_id(user_name_or_id, context):
 session = context['session']
 result = session.query(model.User).filter_by(id=user_name_or_id).first()
 if (not result):
  result = session.query(model.User).filter_by(name=user_name_or_id).first()
 if (not result):
  raise df.Invalid(('%s: %s' % (_('Not found'), _('User'))))
 return result.id

def convert_user_name_or_id_to_id ( user_name_or_id , context ) : session = context [ 'session' ] result = session . query ( model . User ) . filter_by ( id = user_name_or_id ) . first ( ) if ( not result ) : result = session . query ( model . User ) . filter_by ( name = user_name_or_id ) . first ( ) if ( not result ) : raise df . Invalid ( ( '%s: %s' % ( _ ( 'Not found' ) , _ ( 'User' ) ) ) ) return result . id
return the user id for the given user name or id .