Пример #1
0
def request_content(request):
    """
    Handle a request and return a generator which yields all rows 
    in the incoming set.
    """
    format = request_format(request)
    if format == 'json':
        return json.loads(request.data)
    else:
        nv = NestedVariables()
        return nv.to_python(request.form)
Пример #2
0
def request_content(request):
    """
    Handle a request and return a generator which yields all rows 
    in the incoming set.
    """
    format = request_format(request)
    if format == 'json':
        return json.loads(request.data)
    else:
        nv = NestedVariables()
        return nv.to_python(request.form)
Пример #3
0
class AddressesForm(Schema):
    pre_validators = [NestedVariables()]

    class addresses(foreach.ForEach):
        class schema(Schema):
            name = Name()
            email = validators.Email()
Пример #4
0
class SearchForm(Schema):
    pre_validators = [NestedVariables()]
    search = String()
    map = String()
    #game = ForEach(Int(),
    #               OneOf([app.app_id for app in _apps]))
    css = Int(min=0, max=1)
    tf2 = Int(min=0, max=1)
    l4d2 = Int(min=0, max=1)
    gm = Int(min=0, max=1)
    cs = Int(min=0, max=1)
    hl = Int(min=0, max=1)
    kf = Int(min=0, max=1)
    dys = Int(min=0, max=1)
    tws2 = Int(min=0, max=1)
    dods = Int(min=0, max=1)
    mw3 = Int(min=0, max=1)

    vac = Int(min=0, max=1)
    not_full = Int(min=0, max=1)
    not_empty = Int(min=0, max=1)
    no_password = Int(min=0, max=1)

    ignore_key_missing = True
    allow_extra_fields = True
Пример #5
0
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]
Пример #6
0
def request_content():
    """
    Handle a request and return a generator which yields all rows 
    in the incoming set.
    """
    format = request_format(request)
    if format == 'json':
        return json.loads(request.data)
    else:
        data = request.form if request.method == 'POST' \
                else request.args
        return NestedVariables().to_python(data)
Пример #7
0
class EditSchema(CSRFSchema):
    """The class:`~wte.views.user.EditSchema` handles the validation of
    changes to the :class:`~wte.models.User`.
    """
    email = All(UniqueEmailValidator(), EmailDomainValidator(),
                validators.Email(not_empty=True))
    """Updated e-mail address"""
    display_name = validators.UnicodeString(not_empty=True)
    """Updated name"""
    password = validators.UnicodeString()
    """Updated password"""
    option = DictValidator(if_missing=None, accept_iterator=True)

    pre_validators = [NestedVariables()]
 class MySchema(Schema):
     pre_validators = [NestedVariables()]
     people = ForEach(SubSchema(),
                      if_missing=NoDefault,
                      messages={'missing': 'Please add a person'})
Пример #9
0
 def before_main(self):
     if hasattr(cherrypy.request, "params"):
         cherrypy.request.params = \
             NestedVariables.to_python(cherrypy.request.params or {})
Пример #10
0
class IndexListSchema(Schema):
    pre_validators = [NestedVariables()]
    allow_extra_fields = True
    filter_extra_fields = True
    idxlist = ForEach(IndexSchema())
Пример #11
0
class DriverFieldListSchema(Schema):
    pre_validators = [NestedVariables()]
    allow_extra_fields = True
    filter_extra_fields = True
    fieldlist = ForEach(DriverFieldSchema())
Пример #12
0
class ClassListSchema(Schema):
    pre_validators = [NestedVariables()]
    allow_extra_fields = True
    filter_extra_fields = True
    clslist = ForEach(ClassSchema())
Пример #13
0
 def before_main(self):
     if hasattr(request, 'params'):
         request.params = NestedVariables.to_python(request.params or {})