Exemple #1
0
    def from_json_io(cls, io, number=None, validate=True):
        """
        Create an incident from a file.

        @param io: An open file containing JSON text.
        @type io: A file-like object with a C{read} method that returns UTF-8
            L{bytes}.

        @param number: The number of the incident.
            If C{number} is not C{None} and C{text} includes an incident number
            that is different than C{number}, raise an L{InvalidDataError}.
        @type number: L{int}

        @param validate: If true, raise L{InvalidDataError} is the data does
            not validate as a fully-well-formed incident.
        @type validate: L{bool}
        """
        root = from_json_io(io)
        return cls.from_json(root, number, validate)
Exemple #2
0
 def from_json_io(cls, io, number=None, validate=True):
     root = from_json_io(io)
     return cls.from_json(root, number, validate)