~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/browser/archive.py

Merge db-devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
from canonical.launchpad.webapp.authorization import check_permission
75
75
from canonical.launchpad.webapp.badge import HasBadgeBase
76
76
from canonical.launchpad.webapp.batching import BatchNavigator
77
 
from canonical.launchpad.webapp.interfaces import ICanonicalUrlData
 
77
from canonical.launchpad.webapp.interfaces import (
 
78
    ICanonicalUrlData,
 
79
    IStructuredString,
 
80
    )
78
81
from canonical.launchpad.webapp.menu import (
79
82
    NavigationMenu,
80
83
    structured,
145
148
from lp.soyuz.interfaces.binarypackagebuild import BuildSetStatus
146
149
from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
147
150
from lp.soyuz.interfaces.component import IComponentSet
148
 
from lp.soyuz.interfaces.distributionjob import IPackageCopyJobSource
 
151
from lp.soyuz.interfaces.packagecopyjob import IPlainPackageCopyJobSource
149
152
from lp.soyuz.interfaces.packagecopyrequest import IPackageCopyRequestSet
150
153
from lp.soyuz.interfaces.packageset import IPackagesetSet
151
154
from lp.soyuz.interfaces.processor import IProcessorFamilySet
1324
1327
        check_copy_permissions(
1325
1328
            person, dest_archive, dest_series, dest_pocket, spns)
1326
1329
 
1327
 
    job_source = getUtility(IPackageCopyJobSource)
 
1330
    job_source = getUtility(IPlainPackageCopyJobSource)
1328
1331
    archive_pubs = partition_pubs_by_archive(source_pubs)
1329
1332
    for source_archive, spphs in archive_pubs.iteritems():
1330
1333
        job_source.create(
1596
1599
            self.setNextURL()
1597
1600
 
1598
1601
 
 
1602
def get_escapedtext(message):
 
1603
    """Return escapedtext if message is an `IStructuredString`."""
 
1604
    if IStructuredString.providedBy(message):
 
1605
        return message.escapedtext
 
1606
    else:
 
1607
        return message
 
1608
 
 
1609
 
1599
1610
class ArchiveEditDependenciesView(ArchiveViewBase, LaunchpadFormView):
1600
1611
    """Archive dependencies view class."""
1601
1612
 
1792
1803
 
1793
1804
    @property
1794
1805
    def messages(self):
1795
 
        return '\n'.join(self._messages)
 
1806
        return '\n'.join(map(get_escapedtext, self._messages))
1796
1807
 
1797
1808
    def _remove_dependencies(self, data):
1798
1809
        """Perform the removal of the selected dependencies."""
1808
1819
        # Present a page notification describing the action.
1809
1820
        self._messages.append('<p>Dependencies removed:')
1810
1821
        for dependency in selected_dependencies:
1811
 
            self._messages.append('<br/>%s' % dependency.displayname)
 
1822
            self._messages.append(
 
1823
                structured('<br/>%s', dependency.displayname))
1812
1824
        self._messages.append('</p>')
1813
1825
 
1814
1826
    def _add_ppa_dependencies(self, data):
1821
1833
            dependency_candidate, PackagePublishingPocket.RELEASE,
1822
1834
            getUtility(IComponentSet)['main'])
1823
1835
 
1824
 
        self._messages.append(
1825
 
            '<p>Dependency added: %s</p>' % dependency_candidate.displayname)
 
1836
        self._messages.append(structured(
 
1837
            '<p>Dependency added: %s</p>', dependency_candidate.displayname))
1826
1838
 
1827
1839
    def _add_primary_dependencies(self, data):
1828
1840
        """Record the selected dependency."""
1867
1879
        primary_dependency = self.context.addArchiveDependency(
1868
1880
            self.context.distribution.main_archive, dependency_pocket,
1869
1881
            dependency_component)
1870
 
        self._messages.append(
1871
 
            '<p>Primary dependency added: %s</p>' % primary_dependency.title)
 
1882
        self._messages.append(structured(
 
1883
            '<p>Primary dependency added: %s</p>', primary_dependency.title))
1872
1884
 
1873
1885
    def validate(self, data):
1874
1886
        """Validate dependency configuration changes.