Merge lp:~al-maisan/launchpad/url-props-505382 into lp:launchpad

Proposed by Muharem Hrnjadovic
Status: Merged
Merged at revision: not available
Proposed branch: lp:~al-maisan/launchpad/url-props-505382
Merge into: lp:launchpad
Diff against target: 143 lines (+32/-37)
3 files modified
lib/lp/soyuz/interfaces/publishing.py (+16/-15)
lib/lp/soyuz/model/publishing.py (+2/-6)
lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt (+14/-16)
To merge this branch: bzr merge lp:~al-maisan/launchpad/url-props-505382
Reviewer Review Type Date Requested Status
Michael Nelson (community) code Approve
Review via email: mp+17197@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Muharem Hrnjadovic (al-maisan) wrote :

Hello there!

This branch is converting the SPPH.(source|binary)_file_urls properties in to
converted into methods since the operations behind these access the database
and are too heavyweight for properties.

Tests to run:

    bin/test -vv -t xx-source-package-publishing

No (pertinent) "make lint" issues.

Revision history for this message
Michael Nelson (michael.nelson) wrote :

Thanks Muharem! As we discussed verbally, the only confusion here is related to the sample data.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
--- lib/lp/soyuz/interfaces/publishing.py 2010-01-05 18:01:41 +0000
+++ lib/lp/soyuz/interfaces/publishing.py 2010-01-12 05:41:14 +0000
@@ -29,7 +29,7 @@
29 'name_priority_map',29 'name_priority_map',
30 ]30 ]
3131
32from zope.schema import Bool, Choice, Datetime, Int, List, TextLine, Text32from zope.schema import Bool, Choice, Datetime, Int, TextLine, Text
33from zope.interface import Interface, Attribute33from zope.interface import Interface, Attribute
34from lazr.enum import DBEnumeratedType, DBItem34from lazr.enum import DBEnumeratedType, DBItem
3535
@@ -534,20 +534,6 @@
534 title=_("Source Package Version"),534 title=_("Source Package Version"),
535 required=False, readonly=True))535 required=False, readonly=True))
536536
537 source_file_urls = exported(
538 List(
539 value_type=Text(),
540 title=_("Source File URLs"),
541 description=_("URL list for this source publication's "
542 "files from the source upload.")))
543
544 binary_file_urls = exported(
545 List(
546 value_type=Text(),
547 title=_("Binary File URLs"),
548 description=_("URL list for this source publication's "
549 "files resulting from the build.")))
550
551 package_creator = exported(537 package_creator = exported(
552 Reference(538 Reference(
553 IPerson,539 IPerson,
@@ -690,6 +676,21 @@
690 }676 }
691 """677 """
692678
679 @export_read_operation()
680 def sourceFileUrls():
681 """URLs for this source publication's uploaded source files.
682
683 :return: A collection of URLs for this source.
684 """
685
686 @export_read_operation()
687 def binaryFileUrls():
688 """URLs for this source publication's binary files.
689
690 :return: A collection of URLs for this source.
691 """
692
693
693#694#
694# Binary package publishing695# Binary package publishing
695#696#
696697
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2010-01-05 12:01:01 +0000
+++ lib/lp/soyuz/model/publishing.py 2010-01-12 05:41:14 +0000
@@ -865,24 +865,20 @@
865 return [865 return [
866 ProxiedLibraryFileAlias(file, parent).http_url for file in files]866 ProxiedLibraryFileAlias(file, parent).http_url for file in files]
867867
868 @property868 def sourceFileUrls(self):
869 def source_file_urls(self):
870 """See `ISourcePackagePublishingHistory`."""869 """See `ISourcePackagePublishingHistory`."""
871 source_urls = self._proxied_urls(870 source_urls = self._proxied_urls(
872 [file.libraryfile for file in self.sourcepackagerelease.files],871 [file.libraryfile for file in self.sourcepackagerelease.files],
873 self.archive)872 self.archive)
874
875 return source_urls873 return source_urls
876874
877 @property875 def binaryFileUrls(self):
878 def binary_file_urls(self):
879 """See `ISourcePackagePublishingHistory`."""876 """See `ISourcePackagePublishingHistory`."""
880 publishing_set = getUtility(IPublishingSet)877 publishing_set = getUtility(IPublishingSet)
881 binaries = publishing_set.getBinaryFilesForSources(878 binaries = publishing_set.getBinaryFilesForSources(
882 self).config(distinct=True)879 self).config(distinct=True)
883 binary_urls = self._proxied_urls(880 binary_urls = self._proxied_urls(
884 [binary for _source, binary, _content in binaries], self.archive)881 [binary for _source, binary, _content in binaries], self.archive)
885
886 return binary_urls882 return binary_urls
887883
888884
889885
=== modified file 'lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt'
--- lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2010-01-05 18:01:41 +0000
+++ lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2010-01-12 05:41:14 +0000
@@ -111,7 +111,6 @@
111 >>> from lazr.restful.testing.webservice import pprint_entry111 >>> from lazr.restful.testing.webservice import pprint_entry
112 >>> pprint_entry(pubs['entries'][0])112 >>> pprint_entry(pubs['entries'][0])
113 archive_link: u'http://.../~cprov/+archive/ppa'113 archive_link: u'http://.../~cprov/+archive/ppa'
114 binary_file_urls: []
115 component_name: u'main'114 component_name: u'main'
116 date_created: ...115 date_created: ...
117 date_made_pending: None116 date_made_pending: None
@@ -130,7 +129,6 @@
130 scheduled_deletion_date: None129 scheduled_deletion_date: None
131 section_name: u'base'130 section_name: u'base'
132 self_link: u'http://.../~cprov/+archive/ppa/+sourcepub/...'131 self_link: u'http://.../~cprov/+archive/ppa/+sourcepub/...'
133 source_file_urls: [u'http://launchpad.dev/~cprov/+archive/ppa/+files/testwebservice_666.dsc']
134 source_package_name: u'testwebservice'132 source_package_name: u'testwebservice'
135 source_package_version: u'666'133 source_package_version: u'666'
136 status: u'Pending'134 status: u'Pending'
@@ -342,23 +340,23 @@
342340
343 >>> pubs = webservice.named_get(341 >>> pubs = webservice.named_get(
344 ... cprov_archive['self_link'], 'getPublishedSources').jsonBody()342 ... cprov_archive['self_link'], 'getPublishedSources').jsonBody()
345 >>> def print_source_urls(pubs):343 >>> for pub_link in sorted(
346 ... for source_file_urls in sorted(344 ... entry['self_link'] for entry in pubs['entries']):
347 ... entry['source_file_urls'] for entry in pubs['entries']):345 ... source_urls = webservice.named_get(
348 ... print source_file_urls346 ... pub_link, 'sourceFileUrls').jsonBody()
349 >>> print_source_urls(pubs)347 ... print source_urls
350 []348 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/foobar-1.0.dsc']
351 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/firefox_0.9.2.orig.tar.gz', u'http://launchpad.dev/~cprov/+archive/ppa/+files/iceweasel-1.0.dsc']349 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/firefox_0.9.2.orig.tar.gz', u'http://launchpad.dev/~cprov/+archive/ppa/+files/iceweasel-1.0.dsc']
352 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/foobar-1.0.dsc']350 []
353 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/testwebservice_666.dsc']351 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/testwebservice_666.dsc']
354352
355 >>> def print_binary_urls(pubs):353 >>> for pub_link in sorted(
356 ... for binary_file_urls in sorted(354 ... entry['self_link'] for entry in pubs['entries']):
357 ... entry['binary_file_urls'] for entry in pubs['entries']):355 ... binary_urls = webservice.named_get(
358 ... print binary_file_urls356 ... pub_link, 'binaryFileUrls').jsonBody()
359 >>> print_binary_urls(pubs)357 ... print binary_urls
360 []
361 []
362 []358 []
363 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/mozilla-firefox_0.9_i386.deb']359 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/mozilla-firefox_0.9_i386.deb']
360 []
361 []
364362