~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

Merged disco into pgbouncer-fixture.

Show diffs side-by-side

added added

removed removed

Lines of Context:
334
334
 
335
335
    def setDeleted(self, removed_by, removal_comment=None):
336
336
        """Set to DELETED status."""
337
 
        self.status = PackagePublishingStatus.DELETED
338
 
        self.datesuperseded = UTC_NOW
339
 
        self.removed_by = removed_by
340
 
        self.removal_comment = removal_comment
 
337
        getUtility(IPublishingSet).setMultipleDeleted(
 
338
            self.__class__, [self.id], removed_by, removal_comment)
341
339
 
342
340
    def requestObsolescence(self):
343
341
        """See `IArchivePublisher`."""
1966
1964
        if len(ids) == 0:
1967
1965
            return
1968
1966
 
1969
 
        table = publication_class.__name__
1970
 
        permitted_tables = [
1971
 
            'BinaryPackagePublishingHistory',
1972
 
            'SourcePackagePublishingHistory',
 
1967
        permitted_classes = [
 
1968
            BinaryPackagePublishingHistory,
 
1969
            SourcePackagePublishingHistory,
1973
1970
            ]
1974
 
        assert table in permitted_tables, "Deleting wrong type."
1975
 
 
1976
 
        params = sqlvalues(
1977
 
            deleted=PackagePublishingStatus.DELETED, now=UTC_NOW,
1978
 
            removal_comment=removal_comment, removed_by=removed_by)
1979
 
 
1980
 
        IMasterStore(publication_class).execute("\n".join([
1981
 
            "UPDATE %s" % table,
1982
 
            """
1983
 
            SET
1984
 
                status = %(deleted)s,
1985
 
                datesuperseded = %(now)s,
1986
 
                removed_by = %(removed_by)s,
1987
 
                removal_comment = %(removal_comment)s
1988
 
            """ % params,
1989
 
            "WHERE id IN %s" % sqlvalues(ids),
1990
 
            ]))
 
1971
        assert publication_class in permitted_classes, "Deleting wrong type."
 
1972
 
 
1973
        affected_pubs = IMasterStore(publication_class).find(
 
1974
            publication_class, publication_class.id.is_in(ids))
 
1975
        affected_pubs.set(
 
1976
            status=PackagePublishingStatus.DELETED,
 
1977
            datesuperseded=UTC_NOW,
 
1978
            removed_byID=removed_by.id,
 
1979
            removal_comment=removal_comment)
1991
1980
 
1992
1981
    def requestDeletion(self, sources, removed_by, removal_comment=None):
1993
1982
        """See `IPublishingSet`."""