62
62
id = msg.getheader('oops-id')
63
63
exc_type = msg.getheader('exception-type')
64
64
exc_value = msg.getheader('exception-value')
65
date = iso8601.parse_date(msg.getheader('date'))
65
datestr = msg.getheader('date')
66
if datestr is not None:
67
date =iso8601.parse_date(msg.getheader('date'))
66
70
pageid = msg.getheader('page-id')
67
71
username = msg.getheader('user')
68
72
url = msg.getheader('url')
148
152
"""Returns a list of bytestrings making up the serialized oops."""
150
154
chunks.append('Oops-Id: %s\n' % _normalise_whitespace(report['id']))
152
'Exception-Type: %s\n' % _normalise_whitespace(report['type']))
154
'Exception-Value: %s\n' % _normalise_whitespace(report['value']))
155
chunks.append('Date: %s\n' % report['time'].isoformat())
156
chunks.append('Page-Id: %s\n' % _normalise_whitespace(report['pageid']))
157
chunks.append('Branch: %s\n' % _safestr(report['branch_nick']))
158
chunks.append('Revision: %s\n' % report['revno'])
159
chunks.append('User: %s\n' % _normalise_whitespace(report['username']))
160
chunks.append('URL: %s\n' % _normalise_whitespace(report['url']))
161
chunks.append('Duration: %s\n' % report['duration'])
162
chunks.append('Informational: %s\n' % report['informational'])
157
'Exception-Type: %s\n' % _normalise_whitespace(report['type']))
158
if 'value' in report:
160
'Exception-Value: %s\n' % _normalise_whitespace(report['value']))
162
chunks.append('Date: %s\n' % report['time'].isoformat())
163
if 'pageid' in report:
165
'Page-Id: %s\n' % _normalise_whitespace(report['pageid']))
166
if 'branch_nick' in report:
167
chunks.append('Branch: %s\n' % _safestr(report['branch_nick']))
168
if 'revno' in report:
169
chunks.append('Revision: %s\n' % report['revno'])
170
if 'username' in report:
172
'User: %s\n' % _normalise_whitespace(report['username']))
174
chunks.append('URL: %s\n' % _normalise_whitespace(report['url']))
175
if 'duration' in report:
176
chunks.append('Duration: %s\n' % report['duration'])
177
if 'informational' in report:
178
chunks.append('Informational: %s\n' % report['informational'])
163
179
chunks.append('\n')
164
180
safe_chars = ';/\\?:@&+$, ()*!'
165
for key, value in report['req_vars']:
166
chunks.append('%s=%s\n' % (urllib.quote(key, safe_chars),
167
urllib.quote(value, safe_chars)))
169
for (start, end, database_id, statement) in report['db_statements']:
170
chunks.append('%05d-%05d@%s %s\n' % (
171
start, end, database_id, _normalise_whitespace(statement)))
173
chunks.append(report['tb_text'])
181
if 'req_vars' in report:
182
for key, value in report['req_vars']:
183
chunks.append('%s=%s\n' % (urllib.quote(key, safe_chars),
184
urllib.quote(value, safe_chars)))
186
if 'db_statements' in report:
187
for (start, end, database_id, statement) in report['db_statements']:
188
chunks.append('%05d-%05d@%s %s\n' % (
189
start, end, database_id, _normalise_whitespace(statement)))
191
if 'tb_text' in report:
192
chunks.append(report['tb_text'])