(self, name)
return owner._id
:param name: A username, group name, or location name/site_code
        :return: Looks for the given name and returns the corresponding id if the
        user or group exists and None otherwise. Searches for user first, then
        group, then location
:param name: A username, group name, or location name/site_code
        :return: Looks for the given name and returns the corresponding id if the
        user or group exists and None otherwise. Searches for user first, then
        group, then location
: param name : A username group name or location name / site_code : return : Looks for the given name and returns the corresponding id if the user or group exists and None otherwise . Searches for user first then group then location
def _get_id_from_name(self, name):
        '''
        :param name: A username, group name, or location name/site_code
        :return: Looks for the given name and returns the corresponding id if the
        user or group exists and None otherwise. Searches for user first, then
        group, then location
        '''

        def get_user(name):
            try:
                name_as_address = name
                if '@' not in name_as_address:
                    name_as_address = format_username(name, self.domain)
                return CouchUser.get_by_username(name_as_address)
            except NoResultFound:
                return None

        def get_group(name):
            return Group.by_name(self.domain, name, one=True)

        def get_location(name):
            try:
                return SQLLocation.objects.get_from_user_input(self.domain, name)
            except SQLLocation.DoesNotExist:
                return None
            except SQLLocation.MultipleObjectsReturned:
                raise exceptions.DuplicateLocationName()

        owner = get_user(name) or get_group(name) or get_location(name)
        if not owner:
            raise exceptions.InvalidOwnerName('owner_name')
        self._check_owner(owner, 'owner_name')
        return owner._id
def _get_id_from_name ( self , name ) : def get_user ( name ) : try : name_as_address = name if '@' not in name_as_address : name_as_address = format_username ( name , self . domain ) return CouchUser . get_by_username ( name_as_address ) except NoResultFound : return None def get_group ( name ) : return Group . by_name ( self . domain , name , one = True ) def get_location ( name ) : try : return SQLLocation . objects . get_from_user_input ( self . domain , name ) except SQLLocation . DoesNotExist : return None except SQLLocation . MultipleObjectsReturned : raise exceptions . DuplicateLocationName ( ) owner = get_user ( name ) or get_group ( name ) or get_location ( name ) if not owner : raise exceptions . InvalidOwnerName ( 'owner_name' ) self . _check_owner ( owner , 'owner_name' ) return owner . _id