예제 #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')
예제 #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)
예제 #3
0
파일: resource.py 프로젝트: Cbrdiv/burp-ui
 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)
예제 #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)
예제 #5
0
 def __init__(self, api=None, *args, **kwargs):
     self.logger = logging.getLogger(self.__class__.__name__)
     Resource.__init__(self, api, args, kwargs)
예제 #6
0
파일: utils.py 프로젝트: ofekron/chef360
 def __init__(self, api=None, *args, **kwargs):
     Resource.__init__(self, api, *args, **kwargs)
     self.method_decorators = [token_required]