Beispiel #1
0
 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
Beispiel #2
0
    def _modify_package_schema(self, schema):

        # Add custom metadata fields to the schema, this one will use
        # convert_to_extras for all fields.
        _ignore_missing = tk.get_validator('ignore_missing')
        _convert_to_extras = tk.get_converter('convert_to_extras')
        _not_empty = tk.get_validator('not_empty')

        schema.update({
            'variable_names': [_ignore_missing, _convert_to_extras],
            'variable_units': [_ignore_missing, _convert_to_extras],
            'north_extent': [_ignore_missing,
                             v.Number(), _convert_to_extras],
            'west_extent': [_ignore_missing,
                            v.Number(), _convert_to_extras],
            'south_extent': [_ignore_missing,
                             v.Number(), _convert_to_extras],
            'east_extent': [_ignore_missing,
                            v.Number(), _convert_to_extras],
            'cell_size': [_ignore_missing,
                          v.Number(), _convert_to_extras],
            'projection': [_ignore_missing, _convert_to_extras],
            'dataset_type': [_not_empty, _convert_to_extras]
        })

        schema = super(GeographicRasterPlugin, self).modify_schema(schema)
        return schema
Beispiel #3
0
    def _modify_package_schema(self, schema):

        _ignore_missing = tk.get_validator('ignore_missing')
        _convert_to_extras = tk.get_converter('convert_to_extras')
        _not_empty = tk.get_validator('not_empty')

        # Add custom metadata fields to the schema, this one will use
        # convert_to_extras for all fields.
        schema.update({
            'variable_names': [_ignore_missing, _convert_to_extras],
            'variable_units': [_ignore_missing, _convert_to_extras],
            'north_extent': [_ignore_missing,
                             v.Number(), _convert_to_extras],
            'west_extent': [_ignore_missing,
                            v.Number(), _convert_to_extras],
            'south_extent': [_ignore_missing,
                             v.Number(), _convert_to_extras],
            'east_extent': [_ignore_missing,
                            v.Number(), _convert_to_extras],
            'data_start_day':
            [_ignore_missing,
             v.DateConverter(), _convert_to_extras],
            'data_end_day':
            [_ignore_missing,
             v.DateConverter(), _convert_to_extras],
            'projection': [_ignore_missing, _convert_to_extras],
            'dataset_type': [_not_empty, _convert_to_extras]
        })

        schema = super(MultidimensionalSpaceTimePlugin,
                       self).modify_schema(schema)
        return schema
Beispiel #4
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
Beispiel #5
0
class DatastoreSchema(schema.Schema):
    uri = validators.UnicodeString(if_missing=None, if_empty=None)
    master = validators.UnicodeString(if_missing=None, if_empty=None)
    slaves = validators.UnicodeString(if_missing=None, if_empty=None)
    database = validators.UnicodeString(if_missing=None, if_empty=None)
    authenticate = AuthenticateSchema(if_missing=None, if_empty=None)
    connect_retry = validators.Number(if_missing=3, if_empty=0)
    use_greenlets = validators.Bool(if_missing=False)
    # pymongo
    network_timeout = validators.Number(if_missing=None, if_empty=None)
    tz_aware = validators.Bool(if_missing=False)
    slave_okay = validators.Bool(if_missing=False)
    max_pool_size = validators.Int(if_missing=10)
Beispiel #6
0
class ProfileEditForm(formencode.Schema):
    allow_extra_fields = True
    ignore_key_missing = True
    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.Number(not_empty=True)
    ext_rtp_ip = validators.String(not_empty=True)
    ext_sip_ip = validators.String(not_empty=True)
    rtp_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)
Beispiel #7
0
class MPlotForm( formencode.Schema ):
    use_builtin_gettext = False
    allow_extra_fields = True
    filter_extra_fields = True
    pdb_file = FileUploadValidator( not_empty=True, use_builtin_gettext=False )
    probe_radius = validators.Number(
        min=0.4, max=3.0, if_empty=1.4, if_missing=1.4, use_builtin_gettext=False )
Beispiel #8
0
class ArtworkFormSchema(formencode.Schema):
    title = validators.ByteString(not_empty=True)
    dimensions = validators.ByteString(if_missing=True)
    list_price = validators.Number(if_missing=False)
    notes = validators.ByteString(if_missing=False)
    medium = validators.ByteString(if_missing=False)
    creation_date = ISO8601Date(if_missing=False)
Beispiel #9
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)
Beispiel #10
0
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)
Beispiel #11
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()
Beispiel #12
0
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)
Beispiel #13
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)
    require_selection = 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)
Beispiel #14
0
class InstanceVotingEditForm(formencode.Schema):
    allow_extra_fields = True
    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)
    activation_delay = validators.Int(not_empty=True)
    required_majority = validators.Number(not_empty=True)
Beispiel #15
0
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)
Beispiel #16
0
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)
Beispiel #17
0
    class DatastoreSchema(schema.Schema):
        allow_extra_fields = True

        uri = validators.UnicodeString(if_missing=None, if_empty=None)
        database = validators.UnicodeString(if_missing=None, if_empty=None)
        connect_retry = validators.Number(if_missing=3, if_empty=0)
        auto_ensure_indexes = validators.StringBool(if_missing=True)
        # pymongo
        tz_aware = validators.Bool(if_missing=False)
class ImportForm(formencode.Schema):
    """
    Validate for Import Connectivity Form
    """
    server_ip = validators.IPAddress(not_empty=True)
    username = validators.UnicodeString(not_empty=True)
    password = validators.UnicodeString()
    threads_number = validators.Number()

    dti_scans = FileUploadValidator()

    subject_name = validators.UnicodeString()
    subject_sex = validators.OneOf(['Any', 'Male', 'Female'])
    subject_age = validators.Number()
    subject_race = validators.UnicodeString()
    subject_nationality = validators.UnicodeString()
    subject_education = validators.UnicodeString()
    subject_health = validators.UnicodeString()
Beispiel #19
0
class InstanceVotingEditForm(formencode.Schema):
    allow_extra_fields = True
    allow_delegate = validators.StringBool(not_empty=False, if_empty=False,
                                           if_missing=False)
    if not config.get_bool('adhocracy.hide_final_adoption_votings'):
        allow_adopt = validators.StringBool(not_empty=False, if_empty=False,
                                            if_missing=False)
        activation_delay = validators.Int(not_empty=True)
        required_majority = validators.Number(not_empty=True)
    votedetail_badges = forms.ValidUserBadges()
Beispiel #20
0
class PlanSchema(Schema):
    filter_extra_fields = True
    allow_extra_fields = True
    name = validators.UnicodeString(not_empty=True, strip=True)
    price_per_month = validators.Number(not_empty=True, strip=True)
    max_listings = validators.Int(not_empty=True, strip=True)
    max_premium_listings = validators.Int(not_empty=True, strip=True)
    max_blogposts = validators.Int(not_empty=True, strip=True)
    max_premium_blogposts = validators.Int(not_empty=True, strip=True)
    featured_profile = validators.Bool(not_empty=True)
Beispiel #21
0
    def _modify_package_schema(self, schema):

        # TODO: need to implement chained validators
        # that allows to validate a group of fields together
        # e.g if start_date is entered then end_date is required

        # Add custom metadata fields to the schema, this one will use
        # convert_to_extras for all fields except for package_type for which convert_to_tags will be used.
        _not_empty = tk.get_validator('not_empty')
        _ignore_missing = tk.get_validator('ignore_missing')
        _convert_to_extras = tk.get_converter('convert_to_extras')

        schema.update({
            'pkg_model_name': [_not_empty, _convert_to_extras],
            'model_version': [_not_empty, _convert_to_extras],
            'north_extent': [_ignore_missing,
                             v.Number(), _convert_to_extras],
            'west_extent': [_ignore_missing,
                            v.Number(), _convert_to_extras],
            'south_extent': [_ignore_missing,
                             v.Number(), _convert_to_extras],
            'east_extent': [_ignore_missing,
                            v.Number(), _convert_to_extras],
            'simulation_start_day':
            [_ignore_missing,
             v.DateConverter(), _convert_to_extras],
            'simulation_end_day':
            [_ignore_missing,
             v.DateConverter(), _convert_to_extras],
            'time_step': [_ignore_missing,
                          v.Number(), _convert_to_extras],
            'package_type': [
                _not_empty,
                tk.get_converter('convert_to_tags')('model_package_types')
            ],
            'package_run_status': [_ignore_missing, _convert_to_extras],
            'package_run_job_id': [_ignore_missing, _convert_to_extras],
            'dataset_type': [_not_empty, _convert_to_extras]
        })

        schema = super(ModelPackagePlugin, self).modify_schema(schema)
        return schema
Beispiel #22
0
class DatastoreSchema(schema.Schema):
    allow_extra_fields = True

    uri = validators.UnicodeString(if_missing=None, if_empty=None)
    database = validators.UnicodeString(if_missing=None, if_empty=None)
    authenticate = AuthenticateSchema(if_missing=None, if_empty=None)
    connect_retry = validators.Number(if_missing=3, if_empty=0)
    use_greenlets = validators.Bool(if_missing=False)
    auto_ensure_indexes = validators.StringBool(if_missing=True)
    # pymongo
    tz_aware = validators.Bool(if_missing=False)
    slave_okay = validators.Bool(if_missing=False)
    max_pool_size = validators.Int(if_missing=10)
Beispiel #23
0
 def fields(self, context):
     year = datetime.datetime.now().year
     fields = [
         self.Field('name',
                    "*Название компании",
                    validators.String(),
                    required=True),
         self.Field('year',
                    "*Год основания",
                    validators.Number(min=1, max=year),
                    required=True),
         self.Field('phone', "*Телефон", PhoneNumber, required=True),
         self.Field('employees_quantity',
                    "*Кол-во работников",
                    validators.Number(),
                    required=True),
         self.Field('date',
                    "*Дата",
                    validators.DateConverter(),
                    required=True),
         self.Field('amount', "*Сумма", validators.Number(), required=True)
     ]
     return fields
Beispiel #24
0
 def fields(self, context):
     year = datetime.datetime.now().year
     fields = [
         self.Field('name', "*Назвнаие", validators.String(),
                    required=True),
         self.Field('city', "*Город", 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('address', "*Адрес", validators.String(), required=True)
     ]
     return fields
Beispiel #25
0
 def __init__(self, request, exercise):
     formfields = [
             FormField('nr',
                label='Nr.', size=4,
                value=exercise.nr if exercise else None,
                required=True,
                validator=validators.Int()),
             FormField('maxpoints',
                label='Punkte', size=4,
                value=exercise.maxpoints if exercise else None,
                # TODO: Nur eine Nachkommastelle erlaubt
                validator=validators.Number(min=0),
                required = True),
             ]
     ObjectForm.__init__(self, exercise, formfields, request, send='Anlegen/Ändern')
Beispiel #26
0
    def fields(self, context):

        fields = [
            self.Field('FIO', "*ФИО", validators.String(), required=True),
            self.Field('date_of_birth', "*Дата рождения",
                       validators.DateConverter()),
            self.Field('position',
                       "*Положение в налоговой",
                       validators.String(),
                       required=True),
            self.Field('salary',
                       "*Стоимость контракта",
                       validators.Number(),
                       units=" " + "UAH")
        ]
        return fields
Beispiel #27
0
class ItemForm(Schema):
    id = validators.Int()
    maxbid = validators.Number()
Beispiel #28
0
class ShareSchema(Schema):
    "Validate individual user shares."
    allow_extra_fields = False
    user_id = validators.Int(not_empty=True)
    amount = validators.Number(if_empty=0)
class AuthPolicyValidator(Schema):
    """Auth policy validate for auth method insights"""
    requirement = validators.String(if_missing=None, if_empty=None)
    amount = validators.Number(if_missing=None)
    types = ForEach(validators.String(), if_missing=None)
    geofences = ForEach(GeoFenceValidator(), if_missing=[], if_empty=[])
class GeoFenceValidator(Schema):
    """GeoFence validator"""
    name = validators.String(if_missing=None)
    latitude = validators.Number()
    longitude = validators.Number()
    radius = validators.Number()