Пример #1
0
#        __customer_business_detail_deals_head__ as __head_detail_deals__, \
#        __customer_business_detail_images_url_head__ as __head_detail_images_url__

field_inputs = {}
field_inputs_user = {}
field_inputs_wrap = _field_inputs_wrap.copy()

field_inputs['business_id'] = {
    'validator': validate.natural(),
    'required': True,
    'type': fields.Integer()
}

field_inputs['type'] = {
    'required': True,
    'validator': validate.str_in_list(argument=['customer'], ),
    'type': fields.String(),
}

field_inputs_wrap['orderBy'] = {
    'validator': validate.str_in_list(
        default='id',
        argument=['id'],
    ),
    'type': fields.String(default='id'),
}
field_inputs_wrap['gallery_nr'] = {
    'validator': validate.natural(default=0),
    'type': fields.Integer(default=0)
}
Пример #2
0
from module.common import GetResource
from module.common import field_inputs_wrap as _field_inputs_wrap
from module.common import field_inputs_ref as _field_inputs_ref
from module.common import field_inputs as _field_inputs

# for serialize
from .__init__ import __objects_ipaddr_head__ as __head__, \
        __objects_ipaddr_heads__ as __heads__

field_inputs = _field_inputs.copy()
field_inputs_ref = _field_inputs_ref.copy()
field_inputs_wrap = _field_inputs_wrap.copy()

field_inputs['ipVersion'] =  {
        'type': fields.String(),
        'validator': validate.str_in_list(argument=['IPv4', 'IPv6'])
        }

field_inputs['type'] =  {
        'type': fields.String(),
        'validator': validate.str_in_list(argument=['Single', 'Range', 'Subnet'])
        }

field_inputs['addr1'] =  {
        'type': fields.String(),
        'validator': validate.str_range(argument={'low': 1, 'high': 64})
}

field_inputs['addr2'] =  field_inputs['addr1'].copy()

field_inputs_wrap['orderBy'] = {
Пример #3
0
#
# init validator
#
field_inputs = _field_inputs.copy()
field_inputs_ref = _field_inputs_ref.copy()
field_inputs_wrap = _field_inputs_wrap.copy()
_reqparse = reqparse.RequestParser()

#
# customise by spec.
#
field_inputs_wrap['orderBy']['type'] = fields.String(default='name')
field_inputs_wrap['orderBy']['validator'] = \
        validate.str_in_list(
                default='name',
                argument=['name', 'type', 'description'],
                )

resource_fields, resource_fields_ref, resource_fields_wrap = GetResource(
    field_inputs, field_inputs_ref, field_inputs_wrap, __heads__)

# not extend to resource_fields
field_inputs['name']['required'] = True
field_inputs[__obj__heads__] = {
    'type': {
        fields.List(
            fields.Nested({
                'id': {
                    'type': fields.Integer(),
                    'required': True
                },
Пример #4
0
    'type': fields.Integer()
}

field_inputs['mtime'] = {
    #'validator': validate.natural(),
    #'type': fields.Integer()
    'type': fields.String(),
    'validator': validate.str_range(argument={
        'low': 1,
        'high': 20
    })
}

field_inputs_wrap['orderBy'] = {
    'validator': validate.str_in_list(
        default='mtime',
        argument=['mtime'],
    ),
    'type': fields.String(default='mtime'),
}

field_inputs_user['avatar_url'] = {
    'type': fields.String(default=""),
    'validator': validate.str_range(default="",
                                    argument={
                                        'low': 1,
                                        'high': 255
                                    })
}

field_inputs_user['id'] = field_inputs['id'].copy()
Пример #5
0
     #'itemsPerPage': {'type': fields.Integer(default=25),
     #,'validator':
     #         {'name':
     #          inputs.int_in_list, 'argument': [0, 25, 50, 100]},
     #         },
 },
 'page': {
     'validator': validate.natural(default=1),
     'type': fields.Integer(default=1),
     #    'validator': {'name': inputs.natural}},
     #'orderBy': {'type': fields.String(default='login'),
 },
 'orderBy': {
     'validator':
     validate.str_in_list(
         default='login',
         argument=['name', 'login', 'email', 'description'],
     ),
     'type':
     fields.String(default='name'),
     #'validator': {'name': inputs.str_in_list,
     #    'argument': ['name', 'login', 'email', 'description']}},
 },
 #'desc': {'type': fields.Boolean(default=False),
 'desc': {
     #'validator': validate.Boolean(default=False),
     #'type': fields.Boolean(default=False),
     'validator': validate.natural(default=0),
     'type': fields.Integer(default=0),
 },
 #    'validator': {'name': inputs.boolean}}
 "type": {
Пример #6
0
field_inputs['type'] =  {
        'validator': validate.natural(),
        'required': True,
        'type': fields.Integer()
        }

field_inputs['dev_id'] =  {
        'type': fields.String(),
        'required': True,
        'validator': validate.str_range(argument={'low': 1, 'high': 255})
        }

field_inputs_wrap['orderBy'] = {
        'validator': validate.str_in_list(
            default='user_id',
            argument=['user_id'],
            ),
        'type': fields.String(default='user_id'),
        }

field_inputs_post = field_inputs.copy()


field_inputs_send['title'] =  {
        'type': fields.String(),
        'required': True,
        'validator': validate.str_range(argument={'low': 1, 'high': 255})
        }
field_inputs_send['message'] =  {
        'type': fields.String(),
        'required': True,
Пример #7
0
limit = platform_model_config[moduleName][__sec_heads__]
max = limit['max']

#
# init validator
#
field_inputs = _field_inputs.copy()
field_inputs_ref = _field_inputs_ref.copy()
field_inputs_wrap = _field_inputs_wrap.copy()
_reqparse = reqparse.RequestParser()

#
# customise by spec.
#

field_inputs_wrap['orderBy']['type'] = validate.str_in_list(
    default='name', argument=['name', 'type', 'description'])
field_inputs['srcIpAddrs'] = {
    # type attribute for marshal
    'type': {
        fields.List(
            fields.Nested({
                'id': {
                    'type': fields.Integer()
                },
                'name': {
                    'type': fields.String(attribute='name')
                }
            }))
    },
    # validate attribute for reqparse
    'validator': {