~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/model/distroseriesdifference.py

  • Committer: Benji York
  • Date: 2011-08-01 12:51:12 UTC
  • mfrom: (13572 devel)
  • mto: This revision was merged to the branch mainline in revision 13573.
  • Revision ID: benji.york@canonical.com-20110801125112-a4euql70924suzb6
mergeĀ fromĀ devel

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    )
21
21
from lazr.enum import DBItem
22
22
from sqlobject import StringCol
23
 
from storm.exceptions import NotOneError
24
23
from storm.expr import (
25
24
    And,
26
25
    Column,
55
54
    )
56
55
from lp.registry.errors import (
57
56
    DistroSeriesDifferenceError,
58
 
    MultipleParentsForDerivedSeriesError,
59
57
    NotADerivedSeriesError,
60
58
    )
61
59
from lp.registry.interfaces.distroseriesdifference import (
407
405
    base_version = StringCol(dbName='base_version', notNull=False)
408
406
 
409
407
    @staticmethod
410
 
    def new(derived_series, source_package_name, parent_series=None):
 
408
    def new(derived_series, source_package_name, parent_series):
411
409
        """See `IDistroSeriesDifferenceSource`."""
412
 
        # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
413
 
        # mandatory as part of multi-parent support.
414
 
        if parent_series is None:
415
 
            try:
416
 
                dsps = getUtility(IDistroSeriesParentSet)
417
 
                dsp = dsps.getByDerivedSeries(
418
 
                    derived_series).one()
419
 
            except NotOneError:
420
 
                raise MultipleParentsForDerivedSeriesError()
421
 
            else:
422
 
                if dsp is None:
423
 
                    raise NotADerivedSeriesError()
424
 
                else:
425
 
                    parent_series = dsp.parent_series
 
410
        dsps = getUtility(IDistroSeriesParentSet)
 
411
        dsp = dsps.getByDerivedAndParentSeries(
 
412
            derived_series, parent_series)
 
413
        if dsp is None:
 
414
            raise NotADerivedSeriesError()
426
415
 
427
416
        store = IMasterStore(DistroSeriesDifference)
428
417
        diff = DistroSeriesDifference()
439
428
        return store.add(diff)
440
429
 
441
430
    @staticmethod
442
 
    def getForDistroSeries(
443
 
        distro_series,
444
 
        difference_type=None,
445
 
        name_filter=None,
446
 
        status=None,
447
 
        child_version_higher=False,
448
 
        parent_series=None,
449
 
        packagesets=None,
450
 
        changed_by=None):
 
431
    def getForDistroSeries(distro_series, difference_type=None,
 
432
                           name_filter=None, status=None,
 
433
                           child_version_higher=False, parent_series=None,
 
434
                           packagesets=None, changed_by=None):
451
435
        """See `IDistroSeriesDifferenceSource`."""
452
436
        if difference_type is None:
453
437
            difference_type = DistroSeriesDifferenceType.DIFFERENT_VERSIONS