From f52ae5535c942eaf255f4517ccaec58ff4c56a38 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 10 Dec 2018 14:58:18 +0100 Subject: [PATCH] Revert "Created function for returning email type" This reverts commit 436055f02cfe37435dac8ed45affefd2f733850b. --- core/admin/mailu/models.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/admin/mailu/models.py b/core/admin/mailu/models.py index a5bf99dd..e723138d 100644 --- a/core/admin/mailu/models.py +++ b/core/admin/mailu/models.py @@ -21,11 +21,6 @@ import dns db = flask_sqlalchemy.SQLAlchemy() config = configuration.ConfigManager() -def email_type(): - if config['DB_FLAVOR'] == 'postgresql': - return CIText() - else: - return db.String(255, collation="NOCASE") class IdnaDomain(db.TypeDecorator): """ Stores a Unicode string in it's IDNA representation (ASCII only) @@ -63,6 +58,9 @@ class IdnaEmail(db.TypeDecorator): idna.decode(domain_name), ) + def __init__(self): + if config['DB_FLAVOR'] == 'postgresql': + self.impl = CIText() class CommaSeparatedList(db.TypeDecorator): @@ -467,7 +465,7 @@ class Fetch(Base): __tablename__ = "fetch" id = db.Column(db.Integer(), primary_key=True) - user_email = db.Column(email_type(), db.ForeignKey(User.email), + user_email = db.Column(db.String(255), db.ForeignKey(User.email), nullable=False) user = db.relationship(User, backref=db.backref('fetches', cascade='all, delete-orphan'))