def parse_django_error(self):
        """Extract the summary part of a Django HTML error."""
        try:
            summary = self.msg.split(u'<body>\n<div id="summary">\n  ', 1)[1]\
                              .split(u'<th>Python Executable:</th>', 1)[0]
            traceback = self.msg.split(u'\n\nTraceback:', 1)[1]\
                                .split(u'</textarea>', 1)[0]
        except IndexError:
            return self.msg
        result = []
        title = None
        for line in strip_tags(summary).split('\n'):
            line_content = unescape_entities(line.strip())
            if line_content:
                if line_content.endswith(':'):
                    title = line_content
                elif title is None:
                    title = line_content % "%s:"
                else:
                    result.append("%s %s\n" % (title, line_content))
        result.append("Status code: %s" % self.status_code)
        indent, indent2 = u'  ', u'    '
        return u"%(summary)s %(traceback)s".strip() % {
            'summary': indent.join(force_unicode(line) for line in result),
            'traceback': indent2.join(force_unicode(line+"\n") \
                                        for line in traceback.split('\n')),
        }
dataset/ETHPy150Open charles-vdulac/django-roa/django_roa/db/exceptions.py/ROAException.parse_django_error/swapped operands of `%`