← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~james-w/python-oops-datedir-repo/new-publisher-api into lp:python-oops-datedir-repo

 

James Westby has proposed merging lp:~james-w/python-oops-datedir-repo/new-publisher-api into lp:python-oops-datedir-repo.

Commit message:
Conform to the new publisher API, returning a list of ids from publish()

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~james-w/python-oops-datedir-repo/new-publisher-api/+merge/152924

Hi,

This updates datedir-repo for the new publish() API. It's easy in this case
as there aren't many knock-on effects, so it's just updating the function
itself, and the testsuite.

Thanks,

James
-- 
https://code.launchpad.net/~james-w/python-oops-datedir-repo/new-publisher-api/+merge/152924
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~james-w/python-oops-datedir-repo/new-publisher-api into lp:python-oops-datedir-repo.
=== modified file 'NEWS'
--- NEWS	2012-09-26 07:05:50 +0000
+++ NEWS	2013-03-12 14:45:45 +0000
@@ -6,6 +6,9 @@
 NEXT
 ----
 
+* Conform to the new oops API for publishers, i.e. return a list of ids
+  from publish() rather than a single id. (James Westby)
+
 0.0.20
 ------
 

=== modified file 'oops_datedir_repo/repository.py'
--- oops_datedir_repo/repository.py	2012-09-26 06:35:34 +0000
+++ oops_datedir_repo/repository.py	2013-03-12 14:45:45 +0000
@@ -122,7 +122,7 @@
         if self.stash_path:
             original_report['datedir_repo_filepath'] = filename
         os.chmod(filename, wanted_file_permission)
-        return report['id']
+        return [report['id']]
 
     def republish(self, publisher):
         """Republish the contents of the DateDirRepo to another publisher.

=== modified file 'oops_datedir_repo/tests/test_repository.py'
--- oops_datedir_repo/tests/test_repository.py	2012-09-26 06:35:34 +0000
+++ oops_datedir_repo/tests/test_repository.py	2013-03-12 14:45:45 +0000
@@ -116,7 +116,7 @@
         # machines / instances.
         expected_md5 = md5(serializer_bson.dumps(report)).hexdigest()
         expected_id = "OOPS-%s" % expected_md5
-        self.assertEqual(expected_id, repo.publish(report, now))
+        self.assertEqual([expected_id], repo.publish(report, now))
         # The file on disk should match the given id.
         with open(repo.root + '/2006-04-01/' + expected_id, 'rb') as fp:
             # And the content serialized should include the id.
@@ -139,7 +139,7 @@
         repo = DateDirRepo(self.useFixture(TempDir()).path, inherit_id=True)
         now = datetime.datetime(2006, 04, 01, 00, 30, 00, tzinfo=utc)
         report = {'time': now, 'id': '45'}
-        self.assertEqual('45', repo.publish(dict(report), now))
+        self.assertEqual(['45'], repo.publish(dict(report), now))
         # And to be sure, check the file on disk.
         dir = repo.root + '/2006-04-01/'
         files = os.listdir(dir)
@@ -153,7 +153,7 @@
         now = datetime.datetime(2006, 04, 01, 00, 30, 00, tzinfo=utc)
         report = {'time': now, 'id': '45'}
         published_report = dict(report)
-        self.assertEqual('45', repo.publish(published_report, now))
+        self.assertEqual(['45'], repo.publish(published_report, now))
         #  The file on disk should have the supplied id.
         with open(published_report['datedir_repo_filepath'], 'rb') as fp:
             self.assertEqual(report, bson.loads(fp.read()))
@@ -170,7 +170,7 @@
         now = datetime.datetime(2006, 04, 01, 00, 30, 00, tzinfo=utc)
         report = {'time': now, 'id': '45'}
         expected_disk_report = dict(report)
-        self.assertEqual('45', repo.publish(report, now))
+        self.assertEqual(['45'], repo.publish(report, now))
         dir = repo.root + '/2006-04-01/'
         files = os.listdir(dir)
         expected_path = dir + files[0]
@@ -236,7 +236,7 @@
         oopses = []
         def publish(report):
             oopses.append(report)
-            return report['id']
+            return [report['id']]
         repo.republish(publish)
         self.assertFalse(os.path.isfile(finished_path))
         self.assertEqual(1, len(oopses))

=== modified file 'setup.py'
--- setup.py	2012-09-26 07:06:27 +0000
+++ setup.py	2013-03-12 14:45:45 +0000
@@ -41,7 +41,7 @@
           'bson',
           'iso8601',
           'launchpadlib', # Needed for pruning - perhaps should be optional.
-          'oops',
+          'oops>=0.0.11',
           'pytz',
           ],
       extras_require = dict(

=== modified file 'versions.cfg'
--- versions.cfg	2012-03-01 20:31:11 +0000
+++ versions.cfg	2013-03-12 14:45:45 +0000
@@ -3,6 +3,7 @@
 
 [versions]
 bson = 0.3.2
+distribute = 0.6.24
 elementtree = 1.2.6-20050316
 fixtures = 0.3.6
 httplib2 = 0.6.0
@@ -13,7 +14,7 @@
 lazr.restfulclient = 0.12.0
 lazr.uri = 1.0.2
 oauth = 1.0.0
-oops = 0.0.10
+oops = 0.0.13
 pytz = 2011n
 setuptools = 0.6c11
 simplejson = 2.1.3


Follow ups