Open RyanSquared opened 6 years ago
this would also probably mean having:
# add-to
class Validator():
def set_field_name(name):
self._name = name
so the name is still accessible and can still be set, but not required for each validator
will need to be done after tests due to incompatibility with current code in tests branch
this would also mean we'd need something like @sb.flask_validator("email", email_validator)
, so that we can actually use this for Flask forms.
this keeps it detached entirely from the names.
alternatively:
import gigaspoon.flask
@gigaspoon.flask.validator({
"email": [email_validator]
})
def validate_email(self, key, field):
return field
Progress made on eb6bc35.
This provides the Flask integration which can be used for sanitizing form inputs and preparing forms.
for example, change:
to look like:
reasoning
with something like SQLAlchemy, we have the following:
the reason we don't assign
name
to the validator is that the SQL and the form might have two different values.