示例#1
0
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)
示例#2
0
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()
示例#3
0
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()
示例#4
0
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)
示例#5
0
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)
示例#6
0
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)
示例#7
0
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)
示例#8
0
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)
示例#9
0
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')]
示例#10
0
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()
示例#11
0
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
示例#12
0
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
示例#13
0
class PublicKeyValidator(Schema):
    id = validators.String()
    active = validators.Bool()
    date_created = ValidateISODate()
    date_expires = ValidateISODate()
    public_key = validators.String()
    allow_extra_fields = True
示例#14
0
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)
示例#15
0
class DirectoryGetDeviceResponseValidator(Schema):
    """Directory get Device response validator"""
    id = validators.String()
    name = validators.String()
    status = validators.Int()
    type = validators.String()
    allow_extra_fields = True
示例#16
0
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
示例#17
0
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)
示例#18
0
文件: dogs.py 项目: MrFlava/Var25bot
 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
示例#19
0
class PasswordResetSchema(BaseSchema):
    password = validators.String(not_empty=True)
    password_confirm = validators.String(not_empty=True)

    chained_validators = [
        validators.FieldsMatch('password', 'password_confirm')
    ]
示例#20
0
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)
示例#21
0
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
示例#22
0
 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
示例#23
0
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)
示例#24
0
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
示例#25
0
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())
示例#26
0
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))
示例#27
0
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')
    ]
示例#28
0
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')
    ]
示例#29
0
 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
示例#30
0
class AddPartSchema(formencode.Schema):

    mpn = formencode.All(
        validators.String(not_empty=True, strip=True),
        UniqueMPN(),
    )
    description = validators.String()
    manufacturer = validators.String()