Avoid having an empty entry in destionation fields

master
Pierre Jaury 8 years ago
parent 5581f1b0d9
commit 6af7a07e77

@ -33,7 +33,7 @@ class CommaSeparatedList(db.TypeDecorator):
return ",".join(value)
def process_result_value(self, value, dialect):
return value.split(",")
return filter(bool, value.split(","))
class Base(db.Model):
@ -135,7 +135,7 @@ class User(Email):
# Filters
forward_enabled = db.Column(db.Boolean(), nullable=False, default=False)
forward_destination = db.Column(db.String(255), nullable=True, default=None)
forward_destination = db.Column(CommaSeparatedList, nullable=True, default=None)
reply_enabled = db.Column(db.Boolean(), nullable=False, default=False)
reply_subject = db.Column(db.String(255), nullable=True, default=None)
reply_body = db.Column(db.Text(), nullable=True, default=None)

Loading…
Cancel
Save