コード例 #1
0
 def __init__(self, reason, reason_code=None, errors=None, **extras):
     """
     :param reason: A nice message describing what was not valid
     :param reason_code: programmatic friendly reason code
     :param errors: A ``list`` or ``dict`` of nested ``ValidationError``
     :param extras: Any extra info about the error you want to convey
     """
     JsonWebError.__init__(self, reason, **extras)
     self.errors = errors
     self.reason_code = reason_code
コード例 #2
0
ファイル: validators.py プロジェクト: androm3da/JsonWeb
 def __init__(self, reason, reason_code=None, errors=None, **extras):
     """
     :param reason: A nice message describing what was not valid
     :param reason_code: programmatic friendly reason code
     :param errors: A ``list`` or ``dict`` of nested ``ValidationError``
     :param extras: Any extra info about the error you want to convey
     """
     JsonWebError.__init__(self, reason, **extras)
     self.errors = errors
     self.reason_code = reason_code
コード例 #3
0
def get_jsonweb_handler(cls):
    arg_spec = get_arg_spec(cls.__init__)
    if arg_spec is None:
        raise JsonWebError("Unable to generate an object_hook handler from "
                           "{0}'s `__init__` method.".format(cls.__name__))
    args, kw = get_arg_spec(cls.__init__)

    return JsonWebObjectHandler(args, kw or None)
コード例 #4
0
    def __get__(self, obj, type=None):

        if type is None:
            return self
        if not isinstance(self.__type, str):
            return self

        from jsonweb.decode import _default_object_handlers
        #``_type`` was a string and now we must get the actual class
        handler = _default_object_handlers.get(self.__type)

        if not handler:
            raise JsonWebError("Cannot find class {0}.".format(self.__type))

        return EnsureType(handler[1],
                          type_name=self.__type_name,
                          optional=(not self.required),
                          nullable=self.nullable)
コード例 #5
0
ファイル: decode.py プロジェクト: androm3da/JsonWeb
 def __init__(self, message, **extras):
     JsonWebError.__init__(self, message, **extras)
コード例 #6
0
 def __init__(self, message, **extras):
     JsonWebError.__init__(self, message, **extras)
コード例 #7
0
ファイル: decode.py プロジェクト: sbermeister/JsonWeb
 def __init__(self, message, error_sub_type, **extras):
     JsonWebError.__init__(self, message, "DATA_DECODE_ERROR", error_sub_type, **extras)
コード例 #8
0
ファイル: decode.py プロジェクト: sbermeister/JsonWeb
 def __init__(self, message, error_sub_type=None, **extras):
     JsonWebError.__init__(self, message, "JSON_PARSE_ERROR", error_sub_type, **extras)
コード例 #9
0
ファイル: base.py プロジェクト: sbermeister/JsonWeb
 def __init__(self, message, errors=None):
     JsonWebError.__init__(self, message, "VALIDATION_ERROR")
     self.errors = errors