Merge lp:~rye/python-oops-tools/u1-prefix-support into lp:python-oops-tools

Proposed by Roman Yepishev
Status: Merged
Approved by: Robert Collins
Approved revision: 20
Merged at revision: 20
Proposed branch: lp:~rye/python-oops-tools/u1-prefix-support
Merge into: lp:python-oops-tools
Diff against target: 44 lines (+21/-3)
2 files modified
src/oopstools/oops/models.py (+10/-3)
src/oopstools/oops/test/test_dboopsloader.py (+11/-0)
To merge this branch: bzr merge lp:~rye/python-oops-tools/u1-prefix-support
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+82556@code.launchpad.net

Commit message

Handle the form of oops prefix guessing that U1 needs.

Description of the change

This adds U1 OOPS prefix format parsing. Test for the OOPS-<hash> passed too.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Thanks for this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/oopstools/oops/models.py'
--- src/oopstools/oops/models.py 2011-11-16 22:46:04 +0000
+++ src/oopstools/oops/models.py 2011-11-17 16:19:23 +0000
@@ -281,11 +281,18 @@
281 if not prefix:281 if not prefix:
282 # Legacy support for pre-reporter using OOPSes.282 # Legacy support for pre-reporter using OOPSes.
283 prefix_match = oops_re.match(oopsid)283 prefix_match = oops_re.match(oopsid)
284 # 37 is len (OOPS-<hash>).284 if prefix_match:
285 if prefix_match is not None and len(oopsid) < 37:
286 prefix = prefix_match.group('oopsprefix')285 prefix = prefix_match.group('oopsprefix')
287 else:286 # Ubuntu One format is prefixZuuid.
287 if len(prefix) > 33 and prefix[-33] == 'Z':
288 prefix = prefix[:-33]
289 elif len(oopsid) >= 37:
290 # 37 is len (OOPS-<hash>).
291 prefix = None
292
293 if not prefix:
288 prefix = 'UNKNOWN'294 prefix = 'UNKNOWN'
295
289 prefix = prefix.upper()296 prefix = prefix.upper()
290 try:297 try:
291 prefix = Prefix.objects.get(value__exact=prefix)298 prefix = Prefix.objects.get(value__exact=prefix)
292299
=== modified file 'src/oopstools/oops/test/test_dboopsloader.py'
--- src/oopstools/oops/test/test_dboopsloader.py 2011-11-16 07:43:57 +0000
+++ src/oopstools/oops/test/test_dboopsloader.py 2011-11-17 16:19:23 +0000
@@ -242,3 +242,14 @@
242 }242 }
243 oops = parsed_oops_to_model_oops(report, 'bug-889982')243 oops = parsed_oops_to_model_oops(report, 'bug-889982')
244 self.assertEqual('UNKNOWN', oops.appinstance.title)244 self.assertEqual('UNKNOWN', oops.appinstance.title)
245
246 def test_u1_report_id_bug_891647(self):
247 # Ubuntu One web apps use their own flavour of unique identifier for
248 # the oopses: prefixZuuid_encoded. We need to make sure that prefix
249 # does not end up being such a string.
250 report = {
251 'id': 'OOPS-2147appserver'\
252 'ZCeCCGJBHEHJCEdABaIIJDCbaJbaAbDce175347',
253 }
254 oops = parsed_oops_to_model_oops(report, 'bug-891647')
255 self.assertEqual('APPSERVER', oops.appinstance.title)

Subscribers

People subscribed via source and target branches

to all changes: