Beispiel #1
0
    def _format_errors(self, errors):
        field = self.field
        if not field:
            return

        identity = ''.join(self.identity)
        for error in self.errors:
            definition = field.errors[error['token']]
            lines = [
                '%s error at %s: %s' %
                (error['title'].capitalize(), identity, error['message'])
            ]

            if definition.show_field:
                lines.append('Field: %r' % field)

            if definition.show_value and self.value is not None:
                lines.append('Value: %r' % self.value)

            if self.tracebacks:
                lines.append('Captured tracebacks:')
                for traceback in self.tracebacks:
                    lines.append(indent(traceback, 2))

            errors.append('\n'.join(lines))
Beispiel #2
0
    def format_errors(self):
        errors = []
        if self.errors:
            self._format_errors(errors)
        if self.structure:
            self._format_structure(errors)

        enumerated_errors = []
        for i, error in enumerate(errors):
            enumerated_errors.append('[%02d] %s' % (i + 1, indent(error, 5, False)))

        return enumerated_errors
Beispiel #3
0
    def format_errors(self):
        errors = []
        if self.errors:
            self._format_errors(errors)
        if self.structure:
            self._format_structure(errors)

        enumerated_errors = []
        for i, error in enumerate(errors):
            enumerated_errors.append('[%02d] %s' % (i + 1, indent(error, 5, False)))

        return enumerated_errors
Beispiel #4
0
    def _format_errors(self, errors):
        field = self.field
        if not field:
            return

        identity = ''.join(self.identity)
        for error in self.errors:
            definition = field.errors[error['token']]
            lines = ['%s error at %s: %s' % (error['title'].capitalize(), identity,
                error['message'])]

            if definition.show_field:
                lines.append('Field: %r' % field)
            if definition.show_value and self.value is not None:
                lines.append('Value: %r' % self.value)

            if self.tracebacks:
                lines.append('Captured tracebacks:')
                for traceback in self.tracebacks:
                    lines.append(indent(traceback, 2))

            errors.append('\n'.join(lines))