Пример #1
0
 def __init__(self, context_creators=None, response_processor=None, view_func=None, decorators=None):
     """
     :type context_creators: list[ContextCreator] | list[(env, **kwargs) -> dict]
     :type response_processor: flask_frontend.common.view_helpers.response_processors.ResponseProcessor | callable(response, dict)
     :type view_func: (env, **kwargs) -> (dict | flask.Response)
     :type decorators: list[(func1) -> func2]
     """
     self.decorators = decorators or []
     self.response_processor = response_processor
     self.context_creators = to_iter(context_creators) if context_creators else []
     self.view_func = view_func or empty_func
     self.view_func_args = get_true_argspec(self.view_func)[0]
Пример #2
0
 def _from_json(cls, json):
     errors = {
         field: map(Error.from_json, to_iter(errors))
         for field, errors in json.iteritems()}
     return cls(errors)