Skip to content

Instantly share code, notes, and snippets.

@rectalogic
Created October 5, 2016 14:21
Show Gist options
  • Save rectalogic/22716c62355b0ce11558d5f33e57cce2 to your computer and use it in GitHub Desktop.
Save rectalogic/22716c62355b0ce11558d5f33e57cce2 to your computer and use it in GitHub Desktop.
from formencode import Schema, ForEach
from formencode.validators import Email, UnicodeString, RequireIfMissing
class TestSchema(Schema):
recipients = ForEach(Email(not_empty=True), convert_to_list=True)
service = UnicodeString(not_empty=False, if_missing=None)
chained_validators = [RequireIfMissing('service', missing='recipients')]
print TestSchema.to_python({})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment