wtforms: reduce code complexity