class SignUpSchema(BaseSchema): username = All(validators.MinLength(4, not_empty=True), RemoveSpecial(), UniqueUsername()) password = validators.MinLength(6, not_empty=True) password_confirm = validators.MinLength(6, not_empty=True) email = All(validators.Email(not_empty=True), UniqueEmail()) chained_validators = [validators.FieldsMatch('password', 'password_confirm')]
class ConferenceForm(formencode.Schema): allow_extra_fields = True extension = formencode.All(UniqueExtension(), validators.NotEmpty(),\ validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(4)) pin = formencode.All(validators.NotEmpty(),\ validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(4))
class SettingSchema(Schema): filter_extra_fields = True allow_extra_fields = True motion_id_prefix = validators.MinLength(2, not_empty=True) admin_password = validators.MinLength(5, not_empty=True) user_password = validators.MinLength(5, not_empty=True) mail_sender = validators.Email(not_empty=True) mail_smtppassword = validators.MinLength(5, not_empty=True) mail_template = validators.MinLength(5, not_empty=True)
class VirtualMailboxForm(formencode.Schema): allow_extra_fields = True vmbox_number = formencode.All(UniqueExtension(), validators.NotEmpty(),\ validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(4)) vm_password = validators.Number(not_empty=True)
class CIDForm(formencode.Schema): allow_extra_fields = True cid_number = formencode.All(validators.NotEmpty(),\ validators.MinLength(10),\ validators.String(not_empty=True),\ validators.MaxLength(10)) pbx_route_id = validators.Number(not_empty=True)
class CrmCampaignForm(formencode.Schema): allow_extra_fields = True ignore_key_missing = True campaign_name = formencode.All(UniqueCampaign(), validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(32)) campaign_extensions = validators.String(not_empty=True)
class DIDForm(formencode.Schema): allow_extra_fields = True ignore_key_missing = True did = formencode.All(UniqueDID(), validators.MinLength(6),\ validators.String(not_empty=True),\ validators.MaxLength(15)) customer_name = validators.String(not_empty=True)
class ProfileForm(formencode.Schema): allow_extra_fields = True name = formencode.All(UniqueProfile(), validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(64)) odbc_credentials = validators.String(not_empty=True) dbname = validators.String(not_empty=True) presence_hosts = validators.String(not_empty=True) caller_id_type = validators.String(not_empty=True) auto_jitterbuffer_msec = validators.Int(not_empty=True) ext_rtp_ip = validators.String(not_empty=True) ext_sip_ip = validators.String(not_empty=True) sip_ip = validators.String(not_empty=True) sip_ip = validators.String(not_empty=True) sip_port = validators.Number(not_empty=True) nonce_ttl = validators.Number(not_empty=True) rtp_timer_name = validators.String(not_empty=True) codec_prefs = validators.String(not_empty=True) inbound_codec_negotiation = validators.String(not_empty=True) rtp_timeout_sec = validators.Number(not_empty=True) rtp_hold_timeout_sec = validators.Number(not_empty=True) rfc2833_pt = validators.Number(not_empty=True) dtmf_duration = validators.Number(not_empty=True) dtmf_type = validators.String(not_empty=True) session_timeout = validators.Number(not_empty=True) multiple_registrations = validators.String(not_empty=True) vm_from_email = validators.String(not_empty=True)
class fields(ew_core.NameList): project_description = ew.HiddenField(label='Public Description') neighborhood = ew.HiddenField(label='Neighborhood') private_project = ew.Checkbox(label="", attrs={'class': 'unlabeled'}) project_name = ew.InputField(label='Project Name', field_type='text', validator=formencode.All( fev.UnicodeString(not_empty=True, max=40), V.MaxBytesValidator(max=40))) project_unixname = ew.InputField( label='Short Name', field_type='text', validator=formencode.All( fev.String(not_empty=True), fev.MinLength(3), fev.MaxLength(15), fev.Regex( r'^[A-z][-A-z0-9]{2,}$', messages={ 'invalid': 'Please use only letters, numbers, and dashes 3-15 characters long.' }), NeighborhoodProjectTakenValidator())) tools = ew.CheckboxSet( name='tools', options=[ ## Required for Neighborhood functional tests to pass ew.Option(label='Wiki', html_value='wiki', selected=True) ])
class VirtualExtensionForm(formencode.Schema): allow_extra_fields = True vextension_number = formencode.All(UniqueExtension(),\ validators.NotEmpty(),\ validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(4)) vextension_did = validators.Number(not_empty=True)
class UserSchema(Schema): filter_extra_fields = True allow_extra_fields = True email = validators.Email(not_empty=True) name = validators.MinLength(2, not_empty=True) vote_weight = validators.Int(max=10, not_empty=True)
class MotionSchema(Schema): """Motion validate schema Motion validate schema to assure title is not null options is a motion options list containing all options description. participants is user id list of all users allowed to vote on this motion. """ filter_extra_fields = True allow_extra_fields = True title = validators.MinLength(2, not_empty=True) desc = validators.String() options = ForEach(validators.String()) participants = ForEach(validators.Int())
class CodeSchema(BaseSchema): username = validators.MinLength(3, not_empty=True) code = validators.MinLength(4, not_empty=True) remember = validators.Bool() referrer = validators.UnicodeString(if_missing=u'')
class EmailAuthCodeSchema(CodeSchema): username = validators.Email(not_empty=True) code = validators.MinLength(8, not_empty=True)
class UsernameSchema(BaseSchema): username = validators.MinLength(3, not_empty=True) referrer = validators.UnicodeString(if_missing=u'')
class NewsCreateSchema(BaseSchema): """ Schema for single news form """ title = validators.MaxLength(60, not_empty=True) text = validators.MinLength(10, not_empty=True) image_url = validators.URL(add_http=False, check_exists=True)
class PbxBlacklistedForm(formencode.Schema): allow_extra_fields = True cid_number = formencode.All(validators.NotEmpty(),\ validators.MinLength(10),\ validators.String(not_empty=True),\ validators.MaxLength(10))
class BlogPostSchema(BaseSchema): """ Schema for blogpost """ title = validators.MinLength(3, not_empty=True) text = validators.MinLength(10, not_empty=True)
class PageEditSchema(BaseSchema): """ Schema for Page edit """ title = validators.MinLength(3, not_empty=True) text = validators.MinLength(10, not_empty=True)
class UsersEditSchema(BaseSchema): search = validators.MinLength(1, not_empty=True)
class BlogCreateSchema(BaseSchema): blogname = validators.MinLength(6, not_empty=True) text = validators.MinLength(10, not_empty=True) image_url = validators.URL(add_http=False, check_exists=True)
class UserEditSchema(BaseSchema): email = All(validators.Email(not_empty=True), UniqueEmail()) new_password = validators.MinLength(6, not_empty=False) new_password_confirm = validators.MinLength(6, not_empty=False) chained_validators = [validators.FieldsMatch('new_password', 'new_password_confirm')]
class LoginSchema(BaseSchema): username = validators.MinLength(3, not_empty=False)
class GroupEditForm(formencode.Schema): allow_extra_fields = True group_name = formencode.All(validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(32)) group_extensions = validators.String(not_empty=True)
class FaxForm(formencode.Schema): allow_extra_fields = True fax_name = formencode.All(UniqueFax(), validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(32))
class MyModelSchema(Schema): filter_extra_fields = True allow_extra_fields = True name = validators.MinLength(5, not_empty=True) value = validators.Int(not_empty=True)