def parser(value): if not value: raise GlomError("Value was not defined") split = value.split(spliton) if len(split) < 2: raise GlomError("Value did not have 2 or more elements") return split[-1] if last else split[0]
def parser(value): if not value: raise GlomError("Value was not defined") try: parsed = validate_email(value, check_deliverability=False, allow_empty_local=True) if selector == "domain": return parsed["domain"] return (first_name(parsed["local"]) if selector == "first_name" else last_name(parsed["local"])).capitalize() except EmailNotValidError as e: raise GlomError(str(e))
def test_unfinalized_glomerror_repr(): assert 'GlomError()' in repr(GlomError())
def required(value): if not value: raise GlomError("Value was not defined") return value