예제 #1
0
class ReviewSchema(Schema):
    filter_extra_fields = True
    allow_extra_fields = True

    name = String(not_empty=True)
    stars = Number(not_empty=True)
    statement = String(not_empty=True)
    description = String(not_empty=True)
예제 #2
0
class ApplnValidator(Schema):
    name = ByteString(not_empty=True)
    email = Email()
    dob = DateConverter(month_style='iso')
    gender = OneOf(['M', 'F'])
    applntype = OneOf(['new', 'renewal'])
    race1_name = ByteString(not_empty=True)
    race1_location = ByteString(not_empty=True)
    race1_date = DateConverter(month_style='iso')
    race1_distance = Number(min=0, max=200)
    race1_units = OneOf(['miles', 'km'])
    race1_time = TimeOptHoursConverter()
    race1_resultslink = URL()
    race2_name = ByteString(not_empty=True)
    race2_location = ByteString(not_empty=True)
    race2_date = DateConverter(month_style='iso')
    race2_distance = Number(min=0, max=200)
    race2_units = OneOf(['miles', 'km'])
    race2_time = TimeOptHoursConverter()
    race2_resultslink = URL()
예제 #3
0
class LipishaInitiateSchema(LipishaBaseSchema):
    api_version = OneOf(LIPISHA_API_VERSIONS, not_empty=True)
    api_type = OneOf([TYPE_INITIATE], not_empty=True)
    transaction_date = TimestampValidator(not_empty=True)
    transaction_amount = Number(not_empty=True)
    transaction_type = OneOf(LIPISHA_TRANSACTION_TYPES, not_empty=True)
    transaction_method = String(not_empty=True)
    transaction_name = String(not_empty=True)
    transaction_mobile = String(not_empty=True)
    transaction_paybill = String(not_empty=True)
    transaction_account = String(not_empty=True)
    transaction_merchant_reference = String()
예제 #4
0
class ClusterConfiguration(Configuration, metaclass=ClusterConfigurationMeta):
    """Local configuration for the MAAS cluster."""

    maas_url = ConfigurationOption(
        "maas_url", "The HTTP URL for the MAAS region.", ExtendedURL(
            require_tld=False, if_missing="http://localhost:5240/MAAS"))

    # TFTP options.
    tftp_port = ConfigurationOption(
        "tftp_port", "The UDP port on which to listen for TFTP requests.",
        Number(min=0, max=(2 ** 16) - 1, if_missing=69))
    tftp_root = ConfigurationOption(
        "tftp_root", "The root directory for TFTP resources.",
        DirectoryString(
            # Don't validate values that are already stored.
            accept_python=True, if_missing=get_tentative_data_path(
                "/var/lib/maas/boot-resources/current")))

    # HTTP options.
    http_workers = ConfigurationOption(
        "http_workers",
        "Number of HTTP workers to run for serving boot images.",
        Number(min=1, if_missing=2))

    # GRUB options.

    @property
    def grub_root(self):
        "The root directory for GRUB resources."
        return os.path.join(self.tftp_root, "grub")

    # NodeGroup UUID Option, used for migrating to rack controller
    cluster_uuid = ConfigurationOption(
        "cluster_uuid", "The UUID for this cluster controller",
        UUIDString(if_missing=UUID_NOT_SET))

    # Debug options.
    debug = ConfigurationOption(
        "debug", "Enable debug mode for detailed error and log reporting.",
        StringBool(if_missing=False))
예제 #5
0
class ClassSchema(Schema):
    allow_extra_fields = True
    filter_extra_fields = True
    code = String(not_empty=True)
    descrip = String(not_empty=True)
    eventtrophy = Bool()
    champtrophy = Bool()
    carindexed = Bool()
    classindex = String()
    classmultiplier = Number(not_empty=True)
    usecarflag = Bool()
    numorder = Int()
    countedruns = Int(if_empty=0)
    caridxrestrict = String()
예제 #6
0
파일: forms.py 프로젝트: elfixit/rhodecode
 class _LdapSettingsForm(formencode.Schema):
     allow_extra_fields = True
     filter_extra_fields = True
     #pre_validators = [LdapLibValidator]
     ldap_active = StringBoolean(if_missing=False)
     ldap_host = UnicodeString(strip=True,)
     ldap_port = Number(strip=True,)
     ldap_tls_kind = OneOf(tls_kind_choices)
     ldap_tls_reqcert = OneOf(tls_reqcert_choices)
     ldap_dn_user = UnicodeString(strip=True,)
     ldap_dn_pass = UnicodeString(strip=True,)
     ldap_base_dn = UnicodeString(strip=True,)
     ldap_filter = UnicodeString(strip=True,)
     ldap_search_scope = OneOf(search_scope_choices)
     ldap_attr_login = All(AttrLoginValidator, UnicodeString(strip=True,))
     ldap_attr_firstname = UnicodeString(strip=True,)
     ldap_attr_lastname = UnicodeString(strip=True,)
     ldap_attr_email = UnicodeString(strip=True,)
예제 #7
0
class IndexSchema(Schema):
    allow_extra_fields = True
    filter_extra_fields = True
    code = String(not_empty=True)
    descrip = String(not_empty=True)
    value = Number(not_empty=True)
예제 #8
0
class InfoVolunteerValidator(Schema):
    common_eventdate = DateConverter(month_style='iso')
    volunteer_hours = Number(min=0, max=200)
    volunteer_comments = NotEmpty()
예제 #9
0
class InfoRaceResultValidator(Schema):
    common_eventdate = DateConverter(month_style='iso')
    raceresult_distance = Number(min=0, max=200)
    raceresult_units = OneOf(['miles', 'km'])
    raceresult_time = TimeOptHoursConverter()