david / django-roa (http://welldev.org/)
Turn your models into remote resources that you can access through Django's ORM. ROA stands for Resource Oriented Architecture.
| commit 125: | 2ff8ad5b3765 |
| parent 124: | e49b40163410 |
| branch: | default |
More robust way to parse Django's errors
11 months ago
Changed (Δ84 bytes):
raw changeset »
django_roa/db/exceptions.py (7 lines added, 4 lines removed)
Up to file-list django_roa/db/exceptions.py:
| … | … | @@ -22,10 +22,13 @@ class ROAException(Exception): |
22 |
22 |
|
23 |
23 |
def parse_django_error(self): |
24 |
24 |
"""Extract the summary part of a Django HTML error.""" |
25 |
summary = self.msg.split(u'<body>\n<div id="summary">\n ', 1)[1]\ |
|
26 |
.split(u'<th>Python Executable:</th>', 1)[0] |
|
27 |
traceback = self.msg.split(u'\n\nTraceback:', 1)[1]\ |
|
28 |
.split(u'</textarea>', 1)[0] |
|
25 |
try: |
|
26 |
summary = self.msg.split(u'<body>\n<div id="summary">\n ', 1)[1]\ |
|
27 |
.split(u'<th>Python Executable:</th>', 1)[0] |
|
28 |
traceback = self.msg.split(u'\n\nTraceback:', 1)[1]\ |
|
29 |
.split(u'</textarea>', 1)[0] |
|
30 |
except IndexError: |
|
31 |
return self.msg |
|
29 |
32 |
result = [] |
30 |
33 |
title = None |
31 |
34 |
for line in strip_tags(summary).split('\n'): |
