← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~sidnei/python-oops-datedir-repo/bz2-oops-serializer into lp:python-oops-datedir-repo

 

Sidnei da Silva has proposed merging lp:~sidnei/python-oops-datedir-repo/bz2-oops-serializer into lp:python-oops-datedir-repo.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~sidnei/python-oops-datedir-repo/bz2-oops-serializer/+merge/95453

If it smells like bz2, it probably is, so decompress it.
-- 
https://code.launchpad.net/~sidnei/python-oops-datedir-repo/bz2-oops-serializer/+merge/95453
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sidnei/python-oops-datedir-repo/bz2-oops-serializer into lp:python-oops-datedir-repo.
=== modified file 'oops_datedir_repo/serializer.py'
--- oops_datedir_repo/serializer.py	2012-02-10 19:24:56 +0000
+++ oops_datedir_repo/serializer.py	2012-03-01 20:45:30 +0000
@@ -33,6 +33,8 @@
     'read',
     ]
 
+import bz2
+
 from StringIO import StringIO
 
 from oops_datedir_repo import (
@@ -54,6 +56,8 @@
     if len(content) == 0:
         # This OOPS has no content
         raise IOError("Empty OOPS Report")
+    if content[0:3] == "BZh":
+        content = bz2.decompress(content)
     try:
         return serializer_bson.read(StringIO(content))
     except (KeyError, bson.InvalidBSON):

=== modified file 'oops_datedir_repo/tests/test_serializer.py'
--- oops_datedir_repo/tests/test_serializer.py	2012-02-10 19:24:56 +0000
+++ oops_datedir_repo/tests/test_serializer.py	2012-03-01 20:45:30 +0000
@@ -17,6 +17,7 @@
 
 __metaclass__ = type
 
+import bz2
 import datetime
 import StringIO
 
@@ -67,6 +68,12 @@
         source_file.seek(0)
         self.assertEqual(self.expected_dict, read(source_file))
 
+    def test_read_detect_bz2(self):
+        source_file = StringIO.StringIO()
+        source_file.write(bz2.compress(dumps(dict(self.source_dict))))
+        source_file.seek(0)
+        self.assertEqual(self.expected_dict, read(source_file))
+
     def test_ioerror_on_empty_oops(self):
         source_file = StringIO.StringIO()
         self.assertRaises(IOError, read, source_file)

=== modified file 'versions.cfg'
--- versions.cfg	2011-11-15 21:47:32 +0000
+++ versions.cfg	2012-03-01 20:45:30 +0000
@@ -13,11 +13,11 @@
 lazr.restfulclient = 0.12.0
 lazr.uri = 1.0.2
 oauth = 1.0.0
-oops = 0.0.8
-pytz = 2010o
+oops = 0.0.10
+pytz = 2011n
 setuptools = 0.6c11
 simplejson = 2.1.3
-testtools = 0.9.11
+testtools = 0.9.14
 wadllib = 1.2.0
 wsgi-intercept = 0.4
 zc.recipe.egg = 1.3.2