class ContextEditForm(formencode.Schema): allow_extra_fields = True ignore_key_missing = True id = validators.String(not_empty=True) profile = validators.String(not_empty=True) context = validators.String(not_empty=True) customer_id = validators.Number(not_empty=True)
class AdminEditUserForm(formencode.Schema): allow_extra_fields = True ignore_key_missing = True id = validators.Number(not_empty=True) first_name = validators.String(not_empty=True) last_name = validators.String(not_empty=True) password = SecurePassword()
class CustUserAdminForm(formencode.Schema): allow_extra_fields = True ignore_key_missing = True first_name = validators.String(not_empty=True) last_name = validators.String(not_empty=True) username = formencode.All(UniqueUsername()) password = SecurePassword()
class ExtensionForm(formencode.Schema): allow_extra_fields = True extension = formencode.All(UniqueExtension(), validators.NotEmpty(),\ validators.MinLength(3),\ validators.String(not_empty=True),\ validators.MaxLength(4)) password = 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 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 ExistingPersonSchema(BaseSchema): allow_extra_fields = False experience = validators.String(not_empty=True) bio = validators.String(not_empty=True) url = validators.URL(add_http=True, check_exists=False, not_empty=False) phone = validators.String(not_empty=True)
class MessageSchema(Schema): ''' Represent Message Document - MongoDB ''' title = validators.String(not_empty=True, max=100) author = validators.String(not_empty=True) content = validators.String(not_empty=True)
class RegisterForm(BaseForm): login = validators.String(not_empty=True,strip=True,min=4,max=20) email = validators.Email(not_empty=True,strip=True) name = validators.String(not_empty=True,strip=True) password = validators.String(not_empty=True) password_confirm = validators.String(not_empty=True) chained_validators = [validators.FieldsMatch('password', 'password_confirm')]
class PaymentSchema(BaseSchema): approved = validators.Int(min=0, max=1, not_empty=True) amount_paid = validators.Int(min=0, max=2000000) currency_used = validators.String() gateway_ref = validators.String() email_address = validators.String(not_empty=False) success_code = validators.String()
class AuthorizationResponseValidator(Schema): auth = validators.String() service_user_hash = validators.String() org_user_hash = validators.String() user_push_id = validators.String() public_key_id = validators.String() allow_extra_fields = True
class AuthorizationResponsePackageValidator(Schema): """Authorization Response Package entity validator""" service_pins = ForEach() auth_request = validators.String() # UUID response = validators.Bool() device_id = validators.String() allow_extra_fields = True
class PublicKeyValidator(Schema): id = validators.String() active = validators.Bool() date_created = ValidateISODate() date_expires = ValidateISODate() public_key = validators.String() allow_extra_fields = True
class DbContentSchema(BaseSchema): title = validators.String(not_empty=True) type = DbContentTypeValidator() url = validators.String() body = validators.String() publish_date = validators.DateConverter(month_style='dd/mm/yyyy') publish_time = validators.TimeConverter(use_datetime=True)
class DirectoryGetDeviceResponseValidator(Schema): """Directory get Device response validator""" id = validators.String() name = validators.String() status = validators.Int() type = validators.String() allow_extra_fields = True
class DirectoryDeviceLinkCompletionValidator(Schema): """Directory User Device link completion validator""" type = validators.OneOf(['DEVICE_LINK_COMPLETION']) device_id = validators.String() device_public_key = validators.String() device_public_key_id = validators.String() allow_extra_fields = True
class ExistingPersonSchema(BaseSchema): allow_extra_fields = False experience = validators.String(not_empty=True) bio = validators.String(not_empty=True) url = validators.String() mobile = validators.String(not_empty=True)
def fields(self, context): year = datetime.datetime.now().year fields = [ self.Field('nickname', "*Кличка", validators.String(), required=True), self.Field('breed', "*Порода", validators.String(), required=True), self.Field('year', "*Год рождения", validators.Number(min=1, max=year), required=True, default=0), self.Field('price', "*Цена за щенка", validators.Number(min=1), required=True, default=0), self.Field('FIO', "*ФИО хозяина", validators.String(), required=True), self.Field('date_of_birth', "*Дата рождения", validators.DateConverter()), self.Field('address', "*Адрес", validators.String(), required=True) ] return fields
class PasswordResetSchema(BaseSchema): password = validators.String(not_empty=True) password_confirm = validators.String(not_empty=True) chained_validators = [ validators.FieldsMatch('password', 'password_confirm') ]
class InstanceEditForm(formencode.Schema): allow_extra_fields = True label = validators.String(min=4, max=254, not_empty=True) description = validators.String(max=100000, if_empty=None, not_empty=False) activation_delay = validators.Int(not_empty=True) required_majority = validators.Number(not_empty=True) default_group = forms.ValidGroup(not_empty=True) locale = validators.String(not_empty=False) allow_adopt = validators.StringBool(not_empty=False, if_empty=False, if_missing=False) allow_delegate = validators.StringBool(not_empty=False, if_empty=False, if_missing=False) allow_propose = validators.StringBool(not_empty=False, if_empty=False, if_missing=False) allow_index = validators.StringBool(not_empty=False, if_empty=False, if_missing=False) use_norms = validators.StringBool(not_empty=False, if_empty=False, if_missing=False) hidden = validators.StringBool(not_empty=False, if_empty=False, if_missing=False) frozen = validators.StringBool(not_empty=False, if_empty=False, if_missing=False) milestones = validators.StringBool(not_empty=False, if_empty=False, if_missing=False)
class DirectoryGetSessionsValidator(Schema): auth_request = validators.String() date_created = ValidateISODate() service_icon = validators.String() service_id = validators.String() service_name = validators.String() allow_extra_fields = True
def fields(self): fields = [ ew.Checkbox(name='EnableVoting', label='Enable voting on tickets'), ew.Checkbox(name='AllowEmailPosting', label='Allow posting replies via email'), ew.TextField(name='TicketMonitoringEmail', label='Email ticket notifications to', validator=fev.Email(), grid_width='7'), ew.SingleSelectField( name='TicketMonitoringType', label='Send notifications for', grid_width='7', options=[ ew.Option(py_value='NewTicketsOnly', label='New tickets only'), ew.Option(py_value='NewPublicTicketsOnly', label='New public tickets only'), ew.Option(py_value='AllTicketChanges', label='All ticket changes'), ew.Option(py_value='AllPublicTicketChanges', label='All public ticket changes'), ]), ffw.MarkdownEdit(name='TicketHelpNew', label='Help text to display on new ticket page', validator=fev.String(), attrs={'style': 'width: 95%'}), ffw.MarkdownEdit( name='TicketHelpSearch', label='Help text to display on ticket list pages (index page,' ' search results, milestone lists)', validator=fev.String(), attrs={'style': 'width: 95%'}), ] return fields
class DatasetEditSchema(Schema): label = validators.String(min=3, max=255) algorithm = validators.String(min=3, max=255) match_aliases = validators.StringBool(if_missing=False) ignore_case = validators.StringBool(if_missing=False) public_edit = validators.StringBool(if_missing=False) normalize_text = validators.StringBool(if_missing=False) enable_invalid = validators.StringBool(if_missing=False)
class ServiceValidator(Schema): id = validators.String() icon = validators.String() name = validators.String() description = validators.String() active = validators.Bool() callback_url = validators.String() allow_extra_fields = True
class ProductSchema(BaseSchema): category = ProductCategoryValidator() active = validators.Bool() description = validators.String(not_empty=True) cost = validators.Int(min=0, max=20000000) auth = validators.String(if_empty=None) validate = validators.String(if_empty=None) ceilings = ForEach(CeilingValidator())
class CreateDbDataForm(formencode.Schema): driver = formencode.All(Driver()) username = formencode.All(validators.String(not_empty=True, min=1)) password = formencode.All(validators.String(not_empty=True, min=1)) host = formencode.All(validators.String(not_empty=True, min=1)) database = formencode.All(validators.String(not_empty=True, min=1)) port = formencode.All(validators.Int(not_empty=True, min=1024)) table = formencode.All(validators.String(not_empty=True, min=1))
class RegistrationSchema(AccountSchema): """ Extend the account schema for user registration. """ email = validators.Email(not_empty=True) password = validators.String(min=4) password_confirm = validators.String() chained_validators = [ validators.FieldsMatch('password', 'password_confirm') ]
class ProfileSchema(AccountSchema): """ Extend the account schema for user profile editing. """ email = validators.Email(not_empty=True) password = validators.String(not_empty=False) password_confirm = validators.String(not_empty=False) chained_validators = [ validators.FieldsMatch('password', 'password_confirm') ]
def fields(self, context): year = datetime.datetime.now().year fields = [self.Field('name', "*Назвнаие", validators.String(), required=True), self.Field('district', "*Район", validators.String(), required=True), self.Field('year', "*Работает с", validators.Number(min=1, max=year), required=True, default=0), self.Field('phone', "*Телефон", PhoneNumber, required=True), self.Field('entrance_fee', "*Вступительный взнос", validators.Number(min=1), required=True)] return fields
class AddPartSchema(formencode.Schema): mpn = formencode.All( validators.String(not_empty=True, strip=True), UniqueMPN(), ) description = validators.String() manufacturer = validators.String()