I just got back to this branch, tested it, and had errors or the webservice branch that tested syncSource(s) through the API. The error was simply because the sources used in the test weren't in the published status, but it was 500ing, rather than a nice API error, so I've updated the code to avoid that also.
Here's the diff:
=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py 2010-01-28 16:54:43 +0000
+++ lib/lp/soyuz/model/archive.py 2010-02-02 11:28:11 +0000
@@ -1127,10 +1127,11 @@ getUtility(ISourcePackageNameSet)[name]
# Grabbing the item at index 0 ensures it's the most recent
# publication.
- sources.append(
- from_archive.getPublishedSources(
- name=name, exact_match=True,
- status=PackagePublishingStatus.PUBLISHED)[0])
+ published_sources = from_archive.getPublishedSources(
+ name=name, exact_match=True,
+ status=PackagePublishingStatus.PUBLISHED)
+ if published_sources.count() > 0:
+ sources.append(published_sources[0])
return sources
Hi gmb,
I just got back to this branch, tested it, and had errors or the webservice branch that tested syncSource(s) through the API. The error was simply because the sources used in the test weren't in the published status, but it was 500ing, rather than a nice API error, so I've updated the code to avoid that also.
Here's the diff:
=== modified file 'lib/lp/ soyuz/model/ archive. py' soyuz/model/ archive. py 2010-01-28 16:54:43 +0000 soyuz/model/ archive. py 2010-02-02 11:28:11 +0000
getUtilit y(ISourcePackag eNameSet) [name] getPublishedSou rces( PackagePublishi ngStatus. PUBLISHED) [0]) getPublishedSou rces( PackagePublishi ngStatus. PUBLISHED) sources. count() > 0: append( published_ sources[ 0])
--- lib/lp/
+++ lib/lp/
@@ -1127,10 +1127,11 @@
# Grabbing the item at index 0 ensures it's the most recent
# publication.
- sources.append(
- from_archive.
- name=name, exact_match=True,
- status=
+ published_sources = from_archive.
+ name=name, exact_match=True,
+ status=
+ if published_
+ sources.
return sources
def _copySources(self, sources, to_pocket, to_series=None,
=== modified file 'lib/lp/ soyuz/stories/ webservice/ xx-archive. txt' soyuz/stories/ webservice/ xx-archive. txt 2009-10-07 08:28:03 +0000 soyuz/stories/ webservice/ xx-archive. txt 2010-02-02 11:57:30 +0000 "package1" , version="1.0", ubuntu_ db.main_ archive)
--- lib/lp/
+++ lib/lp/
@@ -576,9 +576,12 @@
... sourcename=
... archive=
+ >>> from lp.soyuz. interfaces. publishing import ( ngStatus) getPubSource( "package1" , version="1.1", ubuntu_ db.main_ archive) ubuntu_ db.main_ archive, PackagePublishi ngStatus. PUBLISHED)
+ ... PackagePublishi
>>> ignore = test_publisher.
... sourcename=
- ... archive=
+ ... archive=
+ ... status=
>>> ignore = test_publisher. getPubSource( "package2" , version="1.0",
... sourcename=
@@ -742,6 +745,8 @@
>>> private_publication = test_publisher. createSource( publication. secure_ record. status = ( ngStatus. PUBLISHED)
... cprov.archive, 'foocomm', '1.0-1')
+ >>> private_
+ ... PackagePublishi
>>> logout()
@@ -908,8 +913,10 @@
version.
>>> login('<email address hidden>') createSource( createSource( version. secure_ record. status = ( ngStatus. PUBLISHED)
- >>> unused = test_publisher.
+ >>> subsequent_version = test_publisher.
... cprov.archive, 'foocomm', '1.0-2')
+ >>> subsequent_
+ ... PackagePublishi
>>> logout()
>>> print cprov_webservic e.named_ post(