Take out "models" path, as we are already in it

master
Tim Möhlmann 6 years ago committed by GitHub
parent aed80a74fa
commit ed81c076f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -224,17 +224,17 @@ class Email(object):
@classmethod @classmethod
def resolve_domain(cls, email): def resolve_domain(cls, email):
localpart, domain_name = email.split('@', 1) if '@' in email else (None, email) localpart, domain_name = email.split('@', 1) if '@' in email else (None, email)
alternative = models.Alternative.query.get(domain_name) alternative = Alternative.query.get(domain_name)
if alternative: if alternative:
domain_name = alternative.domain_name domain_name = alternative.domain_name
return (localpart, domain_name) return (localpart, domain_name)
@classmethod @classmethod
def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False): def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False):
alias = models.Alias.resolve(localpart, domain_name) alias = Alias.resolve(localpart, domain_name)
if alias: if alias:
return alias.destination return alias.destination
user = models.User.query.get('{}@{}'.format(localpart, domain_name)) user = User.query.get('{}@{}'.format(localpart, domain_name))
if user: if user:
if user.forward_enabled: if user.forward_enabled:
destination = user.forward_destination destination = user.forward_destination

Loading…
Cancel
Save