I try to create SQLalchemy class except existing string type. My type should raise errors if there are special symbols or spaces in value. There is my implementation.
class StringWithoutSpecialSymbols(TypeDecorator):
impl = sa.String
def process_bind_param(self, value, dialect):
if value:
if re.match(r"^[a-z0-9A-Zа-яА-ЯёЁ]+$", value):
return value
raise ValueError("Object shouldn`t contain any special symbols or spaces")
return value
def process_result_value(self, value, dialect):
return value
def copy(self, **kw):
return StringWithoutSpecialSymbols(self.impl.length)
But there is an error
/lib/python3.9/site-packages/flask_admin/contrib/sqla/view.py", line 719, in scaffold_filters
for f in flt:
TypeError: 'NoneType' object is not iterable