def get_organisation_by_name(organisation_name: str) -> Organisation: organisation = Organisation.get_organisation_by_name(organisation_name) if organisation is None: raise NotFound() return organisation
def assert_validate_name(org: Organisation, name: str): """ Validates that the organisation name doesn't exist """ if org.name != name and Organisation.get_organisation_by_name( name) is not None: raise OrganisationServiceError( f"Organisation name already exists: {name}")