~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/publishing.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-22 04:45:35 UTC
  • mfrom: (14565.2.24 apocalyptic-pieces)
  • Revision ID: launchpad@pqm.canonical.com-20111222044535-jbjyzq3hzwiy7g20
[rs=sinzui][no-qa] Move javascript and scripts to lp. Dismantle
 mailnotification.

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
    return archive
153
153
 
154
154
 
 
155
def proxied_urls(files, parent):
 
156
    """Run the files passed through `ProxiedLibraryFileAlias`."""
 
157
    return [
 
158
        ProxiedLibraryFileAlias(file, parent).http_url for file in files]
 
159
 
 
160
 
155
161
class FilePublishingBase:
156
162
    """Base class to publish files in the archive."""
157
163
 
577
583
        # Return a webapp-proxied LibraryFileAlias so that restricted
578
584
        # librarian files are accessible.  Non-restricted files will get
579
585
        # a 302 so that webapp threads are not tied up.
580
 
        the_url = self._proxied_urls((changes_lfa,), self.archive)[0]
 
586
        the_url = proxied_urls((changes_lfa,), self.archive)[0]
581
587
        return the_url
582
588
 
583
589
    def changelogUrl(self):
584
590
        """See `ISourcePackagePublishingHistory`."""
585
591
        lfa = self.sourcepackagerelease.changelog
586
592
        if lfa is not None:
587
 
            return self._proxied_urls((lfa,), self)[0]
 
593
            return proxied_urls((lfa,), self)[0]
588
594
        return None
589
595
 
590
596
    def _getAllowedArchitectures(self, available_archs):
870
876
        assert self.component in (
871
877
            self.archive.getComponentsForSeries(self.distroseries))
872
878
 
873
 
    def _proxied_urls(self, files, parent):
874
 
        """Run the files passed through `ProxiedLibraryFileAlias`."""
875
 
        return [
876
 
            ProxiedLibraryFileAlias(file, parent).http_url for file in files]
877
 
 
878
879
    def sourceFileUrls(self):
879
880
        """See `ISourcePackagePublishingHistory`."""
880
 
        source_urls = self._proxied_urls(
 
881
        source_urls = proxied_urls(
881
882
            [file.libraryfile for file in self.sourcepackagerelease.files],
882
883
             self.archive)
883
884
        return source_urls
887
888
        publishing_set = getUtility(IPublishingSet)
888
889
        binaries = publishing_set.getBinaryFilesForSources(
889
890
            self).config(distinct=True)
890
 
        binary_urls = self._proxied_urls(
 
891
        binary_urls = proxied_urls(
891
892
            [binary for _source, binary, _content in binaries], self.archive)
892
893
        return binary_urls
893
894
 
1322
1323
        """See `IPublishing`."""
1323
1324
        self.setDeleted(removed_by, removal_comment)
1324
1325
 
 
1326
    def binaryFileUrls(self):
 
1327
        """See `IBinaryPackagePublishingHistory`."""
 
1328
        binary_urls = proxied_urls(
 
1329
            [f.libraryfilealias for f in self.files], self.archive)
 
1330
        return binary_urls
 
1331
 
1325
1332
 
1326
1333
def expand_binary_requests(distroseries, binaries):
1327
1334
    """Architecture-expand a dict of binary publication requests.