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
1=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
2--- lib/lp/soyuz/interfaces/publishing.py 2010-01-05 18:01:41 +0000
3+++ lib/lp/soyuz/interfaces/publishing.py 2010-01-12 05:41:14 +0000
4@@ -29,7 +29,7 @@
5 'name_priority_map',
6 ]
7
8-from zope.schema import Bool, Choice, Datetime, Int, List, TextLine, Text
9+from zope.schema import Bool, Choice, Datetime, Int, TextLine, Text
10 from zope.interface import Interface, Attribute
11 from lazr.enum import DBEnumeratedType, DBItem
12
13@@ -534,20 +534,6 @@
14 title=_("Source Package Version"),
15 required=False, readonly=True))
16
17- source_file_urls = exported(
18- List(
19- value_type=Text(),
20- title=_("Source File URLs"),
21- description=_("URL list for this source publication's "
22- "files from the source upload.")))
23-
24- binary_file_urls = exported(
25- List(
26- value_type=Text(),
27- title=_("Binary File URLs"),
28- description=_("URL list for this source publication's "
29- "files resulting from the build.")))
30-
31 package_creator = exported(
32 Reference(
33 IPerson,
34@@ -690,6 +676,21 @@
35 }
36 """
37
38+ @export_read_operation()
39+ def sourceFileUrls():
40+ """URLs for this source publication's uploaded source files.
41+
42+ :return: A collection of URLs for this source.
43+ """
44+
45+ @export_read_operation()
46+ def binaryFileUrls():
47+ """URLs for this source publication's binary files.
48+
49+ :return: A collection of URLs for this source.
50+ """
51+
52+
53 #
54 # Binary package publishing
55 #
56
57=== modified file 'lib/lp/soyuz/model/publishing.py'
58--- lib/lp/soyuz/model/publishing.py 2010-01-05 12:01:01 +0000
59+++ lib/lp/soyuz/model/publishing.py 2010-01-12 05:41:14 +0000
60@@ -865,24 +865,20 @@
61 return [
62 ProxiedLibraryFileAlias(file, parent).http_url for file in files]
63
64- @property
65- def source_file_urls(self):
66+ def sourceFileUrls(self):
67 """See `ISourcePackagePublishingHistory`."""
68 source_urls = self._proxied_urls(
69 [file.libraryfile for file in self.sourcepackagerelease.files],
70 self.archive)
71-
72 return source_urls
73
74- @property
75- def binary_file_urls(self):
76+ def binaryFileUrls(self):
77 """See `ISourcePackagePublishingHistory`."""
78 publishing_set = getUtility(IPublishingSet)
79 binaries = publishing_set.getBinaryFilesForSources(
80 self).config(distinct=True)
81 binary_urls = self._proxied_urls(
82 [binary for _source, binary, _content in binaries], self.archive)
83-
84 return binary_urls
85
86
87
88=== modified file 'lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt'
89--- lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2010-01-05 18:01:41 +0000
90+++ lib/lp/soyuz/stories/webservice/xx-source-package-publishing.txt 2010-01-12 05:41:14 +0000
91@@ -111,7 +111,6 @@
92 >>> from lazr.restful.testing.webservice import pprint_entry
93 >>> pprint_entry(pubs['entries'][0])
94 archive_link: u'http://.../~cprov/+archive/ppa'
95- binary_file_urls: []
96 component_name: u'main'
97 date_created: ...
98 date_made_pending: None
99@@ -130,7 +129,6 @@
100 scheduled_deletion_date: None
101 section_name: u'base'
102 self_link: u'http://.../~cprov/+archive/ppa/+sourcepub/...'
103- source_file_urls: [u'http://launchpad.dev/~cprov/+archive/ppa/+files/testwebservice_666.dsc']
104 source_package_name: u'testwebservice'
105 source_package_version: u'666'
106 status: u'Pending'
107@@ -342,23 +340,23 @@
108
109 >>> pubs = webservice.named_get(
110 ... cprov_archive['self_link'], 'getPublishedSources').jsonBody()
111- >>> def print_source_urls(pubs):
112- ... for source_file_urls in sorted(
113- ... entry['source_file_urls'] for entry in pubs['entries']):
114- ... print source_file_urls
115- >>> print_source_urls(pubs)
116- []
117+ >>> for pub_link in sorted(
118+ ... entry['self_link'] for entry in pubs['entries']):
119+ ... source_urls = webservice.named_get(
120+ ... pub_link, 'sourceFileUrls').jsonBody()
121+ ... print source_urls
122+ [u'http://launchpad.dev/~cprov/+archive/ppa/+files/foobar-1.0.dsc']
123 [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']
124- [u'http://launchpad.dev/~cprov/+archive/ppa/+files/foobar-1.0.dsc']
125+ []
126 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/testwebservice_666.dsc']
127
128- >>> def print_binary_urls(pubs):
129- ... for binary_file_urls in sorted(
130- ... entry['binary_file_urls'] for entry in pubs['entries']):
131- ... print binary_file_urls
132- >>> print_binary_urls(pubs)
133- []
134- []
135+ >>> for pub_link in sorted(
136+ ... entry['self_link'] for entry in pubs['entries']):
137+ ... binary_urls = webservice.named_get(
138+ ... pub_link, 'binaryFileUrls').jsonBody()
139+ ... print binary_urls
140 []
141 [u'http://launchpad.dev/~cprov/+archive/ppa/+files/mozilla-firefox_0.9_i386.deb']
142+ []
143+ []
144