fix bugs in model and schema introduced by #1604

master
Alexander Graf 3 years ago
parent 7481a6d272
commit 92896ae646

@ -628,10 +628,10 @@ class Alias(Base, Email):
sqlalchemy.and_(cls.domain_name == domain_name, sqlalchemy.and_(cls.domain_name == domain_name,
sqlalchemy.or_( sqlalchemy.or_(
sqlalchemy.and_( sqlalchemy.and_(
cls.wildcard is False, cls.wildcard == False,
cls.localpart == localpart cls.localpart == localpart
), sqlalchemy.and_( ), sqlalchemy.and_(
cls.wildcard is True, cls.wildcard == True,
sqlalchemy.bindparam('l', localpart).like(cls.localpart) sqlalchemy.bindparam('l', localpart).like(cls.localpart)
) )
) )
@ -643,10 +643,10 @@ class Alias(Base, Email):
sqlalchemy.and_(cls.domain_name == domain_name, sqlalchemy.and_(cls.domain_name == domain_name,
sqlalchemy.or_( sqlalchemy.or_(
sqlalchemy.and_( sqlalchemy.and_(
cls.wildcard is False, cls.wildcard == False,
sqlalchemy.func.lower(cls.localpart) == localpart_lower sqlalchemy.func.lower(cls.localpart) == localpart_lower
), sqlalchemy.and_( ), sqlalchemy.and_(
cls.wildcard is True, cls.wildcard == True,
sqlalchemy.bindparam('l', localpart_lower).like( sqlalchemy.bindparam('l', localpart_lower).like(
sqlalchemy.func.lower(cls.localpart)) sqlalchemy.func.lower(cls.localpart))
) )

@ -590,7 +590,7 @@ class DkimKeyField(fields.String):
value = value[:pos] value = value[:pos]
else: else:
footer = '-----END PRIVATE KEY-----' footer = '-----END PRIVATE KEY-----'
except ValueError: except ValueError as exc:
raise ValidationError(f'invalid dkim key {bad_key!r}') from exc raise ValidationError(f'invalid dkim key {bad_key!r}') from exc
# remove whitespace from key data # remove whitespace from key data

Loading…
Cancel
Save