コード例 #1
0
ファイル: schemata.py プロジェクト: jrwdunham/remple
class LocationSchema(Schema):
    description = UnicodeString(max=256)
    purpose = OneOf(_flatten(models.Location.PURPOSE_CHOICES))
    relative_path = UnicodeString()
    quota = Int(min=0)
    enabled = Bool()
    space = ResourceURI(model_cls=models.Space)
    pipeline = ForEach(ResourceURI(model_cls=models.Pipeline))
    replicators = ForEach(ResourceURI(model_cls=models.Location))
コード例 #2
0
ファイル: schemata.py プロジェクト: jrwdunham/remple
class UserSchema(Schema):
    username = Regex(r'^[a-zA-Z0-9_@+\.-]+$', max=150)
    password = UnicodeString()
    first_name = UnicodeString(max=30)
    last_name = UnicodeString(max=150)
    email = Email()
    groups = ForEach(ResourceURI(model_cls=Group))
    user_permissions = ForEach(ResourceURI(model_cls=Permission))
    is_staff = Bool()
    is_active = Bool()
    is_superuser = Bool()
コード例 #3
0
ファイル: validators.py プロジェクト: pombredanne/old-webapp
class NewFormForm(Schema):
    """NewFormForm is a Schema for validating the data entered at the Add Form
    page.
    
    """

    allow_extra_fields = True
    filter_extra_fields = True
    pre_validators = [variabledecode.NestedVariables()]
    transcription = UnicodeString(
        not_empty=True, messages={'empty': 'Please enter a transcription.'})
    phoneticTranscription = UnicodeString()
    narrowPhoneticTranscription = UnicodeString()
    morphemeBreak = UnicodeString()
    grammaticality = UnicodeString()
    morphemeGloss = UnicodeString()
    glosses = FirstGlossNotEmpty()
    comments = UnicodeString()
    speakerComments = UnicodeString()
    context = UnicodeString()
    elicitationMethod = UnicodeString()
    keywords = ForEach(Keyword())
    syntacticCategory = UnicodeString()
    speaker = UnicodeString()
    elicitor = UnicodeString()
    verifier = UnicodeString()
    source = UnicodeString()
    dateElicited = DateConverter(month_style='mm/dd/yyyy')
コード例 #4
0
class SearchFileForm(Schema):
    """SearchFile is a Schema for validating the search terms entered at the Search Files page."""
    allow_extra_fields = True
    filter_extra_fields = True
    pre_validators = [variabledecode.NestedVariables()]
    searchTerm1 = UnicodeString()
    searchType1 = UnicodeString()
    searchLocation1 = UnicodeString()
    searchTerm2 = UnicodeString()
    searchType2 = UnicodeString()
    searchLocation2 = UnicodeString()
    andOrNot = UnicodeString()
    restrictors = ForEach(RestrictorStruct())
    dateRestrictors = ForEach(DateRestrictorStruct())
    integerRestrictors = ForEach(IntegerRestrictorStruct())
    orderByColumn = UnicodeString()
    orderByDirection = UnicodeString()
コード例 #5
0
ファイル: fields.py プロジェクト: rudyvallejos/GestionItems
 def post_init(self, *args, **kw):
     # Only override the user-provided validator if it's not a ForEach one,
     # which usually means the user needs to perform validation on the list
     # as a whole.
     self._original_validator = self.validator
     if not (isinstance(self.validator, ForEach) or
             (isclass(self.validator)
              and issubclass(self.validator, ForEach))):
         self.validator = ForEach(self.validator)
コード例 #6
0
ファイル: forms.py プロジェクト: biletnam/LCDI_SEATING_CHART
class AddEvidenceForm(Schema):
    reference = v.UnicodeString(not_empty=True)
    bag_num = v.UnicodeString()
    type = GetEvidenceType(not_empty=True)
    originator = v.UnicodeString(not_empty=True)
    comments = v.UnicodeString(not_empty=True)
    location = v.UnicodeString(not_empty=True)
    qr = v.Bool()
    photo = ForEach(UploadEvidencePhoto())
コード例 #7
0
ファイル: spend.py プロジェクト: quentinmit/bluechips
class ExpenditureSchema(AuthFormSchema):
    "Validate an expenditure."
    allow_extra_fields = False
    pre_validators = [NestedVariables()]
    spender_id = validators.Int(not_empty=True)
    amount = model.types.CurrencyValidator(not_empty=True)
    description = validators.UnicodeString(not_empty=True)
    date = validators.DateConverter()
    shares = ForEach(ShareSchema)
    chained_validators = [ValidateNotAllZero]
コード例 #8
0
class BlogPost(Schema):
    allow_extra_fields = True
    filter_extra_fields = True

    title = validators.UnicodeString(
        max=255,
        min=2,
        not_empty=True,
        messages={'empty': u'Please enter a title for your blog post'})
    body = validators.UnicodeString(
        min=5, not_empty=True, messages={'empty': u'Enter your blog post'})
    category_id = ForEach(validators.Int())
コード例 #9
0
class QuestionPost(Schema):
    allow_extra_fields = True
    filter_extra_fields = True

    title = validators.UnicodeString(
        max=255,
        min=2,
        not_empty=True,
        messages={'empty': u'Please ask your question'})
    body = validators.UnicodeString()
    category_id = ForEach(validators.Int())
    state_id = validators.Int()
    city = validators.UnicodeString(max=50)
    anonymous = validators.Int(if_missing=0)
コード例 #10
0
ファイル: schemata.py プロジェクト: jrwdunham/remple
class PackageSchema(Schema):
    current_location = ResourceURI(model_cls=models.Location)
    current_path = UnicodeString()
    description = UnicodeString(max=256)
    encryption_key_fingerprint = UnicodeString(max=512)
    misc_attributes = UnicodeString()
    origin_pipeline = ResourceURI(model_cls=models.Pipeline)
    package_type = OneOf(_flatten(models.Package.PACKAGE_TYPE_CHOICES))
    pointer_file_location = ResourceURI(model_cls=models.Location)
    pointer_file_path = UnicodeString()
    related_packages = ForEach(ResourceURI(model_cls=models.Package))
    replicated_package = ResourceURI(model_cls=models.Package)
    size = Int(min=0)
    status = OneOf(_flatten(models.Package.STATUS_CHOICES))
コード例 #11
0
 class MySchema(Schema):
     pre_validators = [NestedVariables()]
     people = ForEach(SubSchema(),
                      if_missing=NoDefault,
                      messages={'missing': 'Please add a person'})
コード例 #12
0
ファイル: settings.py プロジェクト: pombredanne/old-webapp
class AlterSettingsForm(Schema):
    """AlterSettingsForm is a Schema for validating the data entered at the
    system settings page.

    """

    allow_extra_fields = True
    filter_extra_fields = True
    pre_validators = [variabledecode.NestedVariables()]

    OLName = UnicodeString()
    OLId = UnicodeString()

    MLName = UnicodeString()
    MLId = UnicodeString()
    MLOrthography = UnicodeString()

    headerImageName = UnicodeString()
    colorsCSS = UnicodeString()

    orthographyOptions = [u'Orthography %s' % unicode(i) for i \
                          in range(1,6)]
    storageOrthography = OneOf(orthographyOptions)
    defaultInputOrthography = UnicodeString()
    defaultOutputOrthography = UnicodeString()

    objectLanguageOrthography1Name = UnicodeString()
    objectLanguageOrthography1 = UnicodeString()
    OLO1Lowercase = StringBoolean(if_missing=False)
    OLO1InitialGlottalStops = StringBoolean(if_missing=False)

    objectLanguageOrthography2Name = UnicodeString()
    objectLanguageOrthography2 = UnicodeString()
    OLO2Lowercase = StringBoolean(if_missing=False)
    OLO2InitialGlottalStops = StringBoolean(if_missing=False)

    objectLanguageOrthography3Name = UnicodeString()
    objectLanguageOrthography3 = UnicodeString()
    OLO3Lowercase = StringBoolean(if_missing=False)
    OLO3InitialGlottalStops = StringBoolean(if_missing=False)

    objectLanguageOrthography4Name = UnicodeString()
    objectLanguageOrthography4 = UnicodeString()
    OLO4Lowercase = StringBoolean(if_missing=False)
    OLO4InitialGlottalStops = StringBoolean(if_missing=False)

    objectLanguageOrthography5Name = UnicodeString()
    objectLanguageOrthography5 = UnicodeString()
    OLO5Lowercase = StringBoolean(if_missing=False)
    OLO5InitialGlottalStops = StringBoolean(if_missing=False)

    morphemeBreakIsObjectLanguageString = UnicodeString()

    unrestrictedUsers = ForEach(UnrestrictedUser())

    orthographicValidation = OneOf([u'None', u'Warning', u'Error'])
    narrPhonInventory = UnicodeString()
    narrPhonValidation = OneOf([u'None', u'Warning', u'Error'])
    broadPhonInventory = UnicodeString()
    broadPhonValidation = OneOf([u'None', u'Warning', u'Error'])
    morphPhonInventory = UnicodeString()
    morphDelimiters = UnicodeString()
    morphPhonValidation = OneOf([u'None', u'Warning', u'Error'])
    punctuation = UnicodeString()
    grammaticalities = UnicodeString()
コード例 #13
0
class RestrictorStruct(Schema):
    location = UnicodeString()
    containsNot = UnicodeString()
    allAnyOf = UnicodeString
    options = ForEach(UnicodeString())
コード例 #14
0
 def post_init(self, *args, **kw):
     if self.validator is DefaultValidator and _has_child_validators(self):
         log.debug("Generating a ForEach validator for %r", self)
         self.validator = ForEach(self.children[0].validator)