Esempio n. 1
0
 def __init__(self, api):
     Resource.__init__(self, api)
     self.parser = reqparse.RequestParser()
     self.parser.add_argument('pageSize',
                              type=int,
                              default=20,
                              help='page size cannot be converted')
     self.parser.add_argument('pageNumber',
                              type=int,
                              default=1,
                              help='page size cannot be converted')
Esempio n. 2
0
    def validate_payload(self, func):
        Resource.validate_payload(self, func)

        if getattr(func, '__apidoc__', False) is not False:
            doc = func.__apidoc__
            validate = doc.get('validate', None)
            validate = validate if validate is not None else self.api._validate
            if validate:
                for expect in doc.get('expect', []):
                    # TODO: handle third party handlers
                    if isinstance(expect, list) and len(expect) == 1:
                        if isinstance(expect[0], ModelBase):
                            self._validate(expect[0], collection=True)
                    if isinstance(expect, ModelBase):
                        self._validate(expect, collection=False)
Esempio n. 3
0
 def __init__(self, api=None, *args, **kwargs):
     """Constructor"""
     self.username = current_user.get_id()
     self.is_admin = api.bui.acl and api.bui.acl.is_admin(self.username)
     self.cache = api.cache
     ResourcePlus.__init__(self, api, *args, **kwargs)
Esempio n. 4
0
 def __init__(self, api=None, *args, **kwargs):
     self.username = current_user.get_id()
     self.is_admin = api.bui.acl and api.bui.acl.is_admin(self.username)
     self.cache = api.cache
     ResourcePlus.__init__(self, api, *args, **kwargs)
Esempio n. 5
0
 def __init__(self, api=None, *args, **kwargs):
     self.logger = logging.getLogger(self.__class__.__name__)
     Resource.__init__(self, api, args, kwargs)
Esempio n. 6
0
 def __init__(self, api=None, *args, **kwargs):
     Resource.__init__(self, api, *args, **kwargs)
     self.method_decorators = [token_required]