~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/interfaces/distroseries.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-05-23 18:43:31 UTC
  • mfrom: (13084.2.6 page-match-rewrite-url)
  • Revision ID: launchpad@pqm.canonical.com-20110523184331-dhd2c7cgfuu49epw
[r=sinzui][bug=784273] Adds facility to the PageMatch to handle bad
        URIs

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    export_write_operation,
25
25
    exported,
26
26
    LAZR_WEBSERVICE_EXPORTED,
27
 
    operation_for_version,
28
27
    operation_parameters,
29
28
    operation_returns_collection_of,
30
29
    operation_returns_entry,
37
36
    Reference,
38
37
    ReferenceChoice,
39
38
    )
 
39
from lazr.restful.interface import copy_field
40
40
from zope.component import getUtility
41
41
from zope.interface import (
42
42
    Attribute,
52
52
    )
53
53
 
54
54
from canonical.launchpad import _
 
55
from canonical.launchpad.interfaces.launchpad import IHasAppointedDriver
55
56
from lp.app.interfaces.launchpad import IServiceUsage
56
57
from lp.app.validators import LaunchpadValidationError
57
58
from lp.app.validators.email import email_validator
72
73
    IMilestone,
73
74
    )
74
75
from lp.registry.interfaces.person import IPerson
75
 
from lp.registry.interfaces.role import (
76
 
    IHasAppointedDriver,
77
 
    IHasOwner,
78
 
    )
 
76
from lp.registry.interfaces.role import IHasOwner
79
77
from lp.registry.interfaces.series import (
80
78
    ISeriesMixin,
81
79
    SeriesStatus,
213
211
            description=_("The version string for this series.")))
214
212
    distribution = exported(
215
213
        Reference(
216
 
            Interface,  # Really IDistribution, see circular import fix below.
 
214
            Interface, # Really IDistribution, see circular import fix below.
217
215
            title=_("Distribution"), required=True,
218
216
            description=_("The distribution for which this is a series.")))
219
217
    distributionID = Attribute('The distribution ID.')
220
218
    named_version = Attribute('The combined display name and version.')
221
219
    parent = Attribute('The structural parent of this series - the distro')
222
220
    components = Attribute("The series components.")
223
 
    # IComponent is not exported on the api.
224
 
    component_names = exported(List(
225
 
        value_type=TextLine(),
226
 
        title=_(u'The series component names'),
227
 
        readonly=True))
228
221
    upload_components = Attribute("The series components that can be "
229
222
                                  "uploaded to.")
230
 
    suite_names = exported(List(
231
 
        value_type=TextLine(),
232
 
        title=_(u'The series pocket names'),
233
 
        readonly=True))
234
223
    sections = Attribute("The series sections.")
235
224
    status = exported(
236
225
        Choice(
239
228
    is_derived_series = Bool(
240
229
        title=u'Is this series a derived series?', readonly=True,
241
230
        description=(u"Whether or not this series is a derived series."))
 
231
    is_initialising = Bool(
 
232
        title=u'Is this series initialising?', readonly=True,
 
233
        description=(u"Whether or not this series is initialising."))
242
234
    datereleased = exported(
243
235
        Datetime(title=_("Date released")))
244
236
    previous_series = exported(
245
237
        ReferenceChoice(
246
238
            title=_("Parent series"),
247
239
            description=_("The series from which this one was branched."),
248
 
            required=True, schema=Interface,  # Really IDistroSeries
 
240
            required=True, schema=Interface, # Really IDistroSeries, see below
249
241
            vocabulary='DistroSeries'),
250
242
        ("devel", dict(exported_as="previous_series")),
251
243
        ("1.0", dict(exported_as="parent_series")),
367
359
 
368
360
    main_archive = exported(
369
361
        Reference(
370
 
            Interface,  # Really IArchive, see below for circular import fix.
 
362
            Interface, # Really IArchive, see below for circular import fix.
371
363
            title=_('Distribution Main Archive')))
372
364
 
373
365
    supported = exported(
415
407
    architectures = exported(
416
408
        CollectionField(
417
409
            title=_("All architectures in this series."),
418
 
            value_type=Reference(schema=Interface),  # IDistroArchSeries.
 
410
            value_type=Reference(schema=Interface), # IDistroArchSeries.
419
411
            readonly=True))
420
412
 
421
413
    enabled_architectures = Attribute(
779
771
        DistroSeriesBinaryPackage objects that match the given text.
780
772
        """
781
773
 
782
 
    def createQueueEntry(pocket, archive, changesfilename, changesfilecontent,
783
 
                         signingkey=None, package_copy_job=None):
 
774
    def createQueueEntry(pocket, changesfilename, changesfilecontent,
 
775
                         archive, signingkey=None):
784
776
        """Create a queue item attached to this distroseries.
785
777
 
786
778
        Create a new records respecting the given pocket and archive.
838
830
    def getDerivedSeries():
839
831
        """Get all `DistroSeries` derived from this one."""
840
832
 
841
 
    @operation_returns_collection_of(Interface)
842
 
    @export_read_operation()
843
 
    def getParentSeries():
844
 
        """Get all parent `DistroSeries`."""
845
 
 
846
 
    @operation_parameters(
847
 
        parent_series=Reference(
848
 
            schema=Interface,  # IDistroSeries
849
 
            title=_("The parent series to consider."),
850
 
            required=False),
851
 
        difference_type=Choice(
852
 
            vocabulary=DBEnumeratedType,  # DistroSeriesDifferenceType
853
 
            title=_("Only return differences of this type."), required=False),
854
 
        source_package_name_filter=TextLine(
855
 
            title=_("Only return differences for packages matching this "
856
 
                    "name."),
857
 
            required=False),
858
 
        status=Choice(
859
 
            vocabulary=DBEnumeratedType,  # DistroSeriesDifferenceStatus
860
 
            title=_("Only return differences of this status."),
861
 
            required=False),
862
 
        child_version_higher=Bool(
863
 
            title=_("Only return differences for which the child's version "
864
 
                    "is higher than the parent's."),
865
 
            required=False),
866
 
        )
867
 
    @operation_returns_collection_of(Interface)
868
 
    @export_read_operation()
869
 
    @operation_for_version('devel')
870
 
    def getDifferencesTo(parent_series, difference_type,
871
 
                         source_package_name_filter, status,
872
 
                         child_version_higher):
873
 
        """Return the differences between this series and the specified
874
 
        parent_series (or all the parent series if parent_series is None).
875
 
 
876
 
        :param parent_series: The parent series for which the differences
877
 
            should be returned. All parents are considered if this is None.
878
 
        :param difference_type: The type of the differences to return.
879
 
        :param source_package_name_filter: A package name to use as a filter
880
 
            for the differences.
881
 
        :param status: The status of the differences to return.
882
 
        :param child_version_higher: Only return differences for which the
883
 
            child's version is higher than the parent's version.
884
 
        """
885
 
 
886
 
    def isInitializing():
887
 
        """Is this series initializing?"""
888
 
 
889
 
    def isInitialized():
890
 
        """Has this series been initialized?"""
891
 
 
892
833
 
893
834
class IDistroSeriesEditRestricted(Interface):
894
835
    """IDistroSeries properties which require launchpad.Edit."""
900
841
        """Create a new milestone for this DistroSeries."""
901
842
 
902
843
    @operation_parameters(
903
 
        parents=List(
904
 
            title=_("The list of parents to derive from."),
905
 
            value_type=TextLine(),
906
 
            required=True),
 
844
        name=copy_field(IDistroSeriesPublic['name'], required=True),
 
845
        displayname=copy_field(
 
846
            IDistroSeriesPublic['displayname'], required=False),
 
847
        title=copy_field(IDistroSeriesPublic['title'], required=False),
 
848
        summary=TextLine(
 
849
            title=_("The summary of the distroseries to derive."),
 
850
            required=False),
 
851
        description=copy_field(
 
852
            IDistroSeriesPublic['description'], required=False),
 
853
        version=copy_field(
 
854
            IDistroSeriesPublic['version'], required=False),
 
855
        distribution=copy_field(
 
856
            IDistroSeriesPublic['distribution'], required=False),
907
857
        architectures=List(
908
858
            title=_("The list of architectures to copy to the derived "
909
859
            "distroseries."), value_type=TextLine(),
916
866
            title=_("If binaries will be copied to the derived "
917
867
            "distroseries."),
918
868
            required=True),
919
 
        overlays=List(
920
 
            title=_("The list of booleans indicating, for each parent, if "
921
 
            "the parent/child relationship should be an overlay."),
922
 
            value_type=Bool(),
923
 
            required=False),
924
 
        overlay_pockets=List(
925
 
            title=_("The list of overlay pockets."),
926
 
            value_type=TextLine(),
927
 
            required=False),
928
 
        overlay_components=List(
929
 
            title=_("The list of overlay components."),
930
 
            value_type=TextLine(),
931
 
            required=False),
932
869
        )
933
870
    @call_with(user=REQUEST_USER)
934
871
    @export_write_operation()
935
 
    def initDerivedDistroSeries(user, parents, architectures,
936
 
                                packagesets, rebuild, overlays,
937
 
                                overlay_pockets, overlay_components):
938
 
        """Initialize this series from parents.
939
 
 
940
 
        This method performs checks and then creates a job to populate
941
 
        the new distroseries.
942
 
 
943
 
        :param parents: The list of parent ids this series will derive
944
 
            from.
 
872
    def deriveDistroSeries(user, name, displayname, title, summary,
 
873
                           description, version, distribution,
 
874
                           architectures, packagesets, rebuild):
 
875
        """Derive a distroseries from this one.
 
876
 
 
877
        This method performs checks, can create the new distroseries if
 
878
        necessary, and then creates a job to populate the new
 
879
        distroseries.
 
880
 
 
881
        :param name: The name of the new distroseries we will create if it
 
882
            doesn't exist, or the name of the distroseries we will look
 
883
            up, and then initialise.
 
884
        :param displayname: The Display Name for the new distroseries.
 
885
            If the distroseries already exists this parameter is ignored.
 
886
        :param title: The Title for the new distroseries. If the
 
887
            distroseries already exists this parameter is ignored.
 
888
        :param summary: The Summary for the new distroseries. If the
 
889
            distroseries already exists this parameter is ignored.
 
890
        :param description: The Description for the new distroseries. If the
 
891
            distroseries already exists this parameter is ignored.
 
892
        :param version: The version for the new distroseries. If the
 
893
            distroseries already exists this parameter is ignored.
 
894
        :param distribution: The distribution the derived series will
 
895
            belong to. If it isn't specified this distroseries'
 
896
            distribution is used.
945
897
        :param architectures: The architectures to copy to the derived
946
898
            series. If not specified, all of the architectures are copied.
947
899
        :param packagesets: The packagesets to copy to the derived series.
949
901
        :param rebuild: Whether binaries will be copied to the derived
950
902
            series. If it's true, they will not be, and if it's false, they
951
903
            will be.
952
 
        :param overlays: A list of booleans indicating, for each parent, if
953
 
            the parent/child relationship should be an overlay.
954
 
        :param overlay_pockets: The list of pockets names to use for overlay
955
 
            relationships.
956
 
        :param overlay_components: The list of components names to use for
957
 
            overlay relationships.
958
904
        """
959
905
 
960
906
 
 
907
 
961
908
class IDistroSeries(IDistroSeriesEditRestricted, IDistroSeriesPublic,
962
909
                    IStructuralSubscriptionTarget):
963
910
    """A series of an operating system distribution."""
1035
982
 
1036
983
class DerivationError(Exception):
1037
984
    """Raised when there is a problem deriving a distroseries."""
1038
 
    webservice_error(400)  # Bad Request
 
985
    webservice_error(400) # Bad Request
1039
986
    _message_prefix = "Error deriving distro series"
1040
987
 
1041
988