Beispiel #1
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()
Beispiel #2
0
field_inputs = {}
field_inputs_user = {}
field_inputs_wrap = _field_inputs_wrap.copy()
field_inputs['id'] = {
    'validator': validate.natural(),
    #'required': True,
    'type': fields.Integer()
}

field_inputs['name'] = {
    'validator': validate.str_range(argument={
        'low': 1,
        'high': 255
    }),
    'type': fields.String(default="")
}
#field_inputs['sid'] = {
#        'validator': validate.str_range(argument={'low': 1, 'high': 255}),
#        'type': fields.String()
#        }
# TODO: validator with email
field_inputs['login'] = {
    'validator': validate.email(),
    'type': fields.String(default="")
}
#field_inputs['email'] =  {
#        'validator': validate.str_range(argument={'low': 1, 'high': 255}),
#        'type': fields.String(default="")
#        }
#field_inputs['preferences'] =  {
Beispiel #3
0
#        __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)
}

field_inputs_post = {}
Beispiel #4
0
limit = platform_model_config[moduleName][__heads__]
max = limit['max']
childrenMax = limit['children']

#
# 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({
Beispiel #5
0
# for serialize
from .__init__ import \
        __customer_comment_head__ as __head__, \
        __customer_comment_heads__ as __heads__, \
        __customer_business_detail_head__ as __head_detail__, \
        __customer_business_detail_rates_head__ as __head_detail_rates__, \
        __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['content'] = {
    'type': fields.String(),
    'required': True,
    'validator': validate.str_range(argument={
        'low': 1,
        'high': 255
    })
}

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

field_inputs['business_id'] = {
    'required': True,
    'validator': validate.natural(),
Beispiel #6
0
        }

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

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()

Beispiel #7
0
}

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

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

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

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

field_inputs_post = field_inputs.copy()

resource_fields, resource_fields_post, resource_fields_wrap = GetResource(
    field_inputs, field_inputs_post, field_inputs_wrap, field_inputs_wrap_head)
Beispiel #8
0
from module.common import field_inputs_wrap_head

# for serialize
from .__init__ import __customer_business_head__ as __head__, \
        __customer_business_heads__ as __heads__, \
        __customer_business_detail_head__ as __head_detail__, \
        __customer_business_detail_rates_head__ as __head_detail_rates__, \
        __customer_business_detail_deals_head__ as __head_detail_deals__, \
        __customer_business_detail_images_url_head__ as __head_detail_images_url__

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

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

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

field_inputs['lat'] = {
    'required': True,