~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/interfaces/sourcepackage.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:
9
9
 
10
10
__all__ = [
11
11
    'ISourcePackage',
12
 
    'ISourcePackagePublic',
13
 
    'ISourcePackageEdit',
14
12
    'ISourcePackageFactory',
15
13
    'SourcePackageFileType',
16
14
    'SourcePackageType',
67
65
    )
68
66
 
69
67
 
70
 
class ISourcePackagePublic(IBugTarget, IHasBranches, IHasMergeProposals,
71
 
                           IHasOfficialBugTags, IHasCodeImports,
72
 
                           IHasTranslationImports, IHasTranslationTemplates):
73
 
    """Public attributes for SourcePackage."""
 
68
class ISourcePackage(IBugTarget, IHasBranches, IHasMergeProposals,
 
69
                     IHasOfficialBugTags, IHasCodeImports,
 
70
                     IHasTranslationImports, IHasTranslationTemplates):
 
71
    """A SourcePackage. See the MagicSourcePackage specification. This
 
72
    interface preserves as much as possible of the old SourcePackage
 
73
    interface from the SourcePackage table, with the new table-less
 
74
    implementation."""
 
75
 
 
76
    export_as_webservice_entry()
74
77
 
75
78
    id = Attribute("ID")
76
79
 
77
80
    name = exported(
78
81
        TextLine(
79
 
            title=_("Name"), required=True, readonly=True,
 
82
            title=_("Name"), required=True,
80
83
            description=_("The text name of this source package.")))
81
84
 
82
85
    displayname = exported(
83
86
        TextLine(
84
 
            title=_("Display name"), required=True, readonly=True,
 
87
            title=_("Display name"), required=True,
85
88
            description=_("A displayname, constructed, for this package")))
86
89
 
87
90
    path = Attribute("A path to this package, <distro>/<series>/<package>")
104
107
            Interface,
105
108
            # Really IDistribution, circular import fixed in
106
109
            # _schema_circular_imports.
107
 
            title=_("Distribution"), required=True, readonly=True,
 
110
            title=_("Distribution"), required=True,
108
111
            description=_("The distribution for this source package.")))
109
112
 
110
113
    # The interface for this is really IDistroSeries, but importing that would
112
115
    distroseries = exported(
113
116
        Reference(
114
117
            Interface, title=_("Distribution Series"), required=True,
115
 
            readonly=True,
116
118
            description=_("The DistroSeries for this SourcePackage")))
117
119
 
118
120
    sourcepackagename = Attribute("SourcePackageName")
128
130
    productseries = exported(
129
131
        ReferenceChoice(
130
132
            title=_("Project series"), required=False,
131
 
            vocabulary="ProductSeries", readonly=True,
 
133
            vocabulary="ProductSeries",
132
134
            schema=Interface,
133
135
            description=_(
134
136
                "The registered project series that this source package "
263
265
        :return: An `IBranch`.
264
266
        """
265
267
 
 
268
    # 'pocket' should actually be a PackagePublishingPocket, and 'branch'
 
269
    # should be IBranch, but we use the base classes to avoid circular
 
270
    # imports. Correct interface specific in _schema_circular_imports.
 
271
    @operation_parameters(
 
272
        pocket=Choice(
 
273
            title=_("Pocket"), required=True,
 
274
            vocabulary=DBEnumeratedType),
 
275
        branch=Reference(Interface, title=_("Branch"), required=False))
 
276
    @call_with(registrant=REQUEST_USER)
 
277
    @export_write_operation()
 
278
    def setBranch(pocket, branch, registrant):
 
279
        """Set the official branch for the given pocket of this package.
 
280
 
 
281
        :param pocket: A `PackagePublishingPocket`.
 
282
        :param branch: The branch to set as the official branch.
 
283
        :param registrant: The individual who created this link.
 
284
        :return: None
 
285
        """
 
286
 
266
287
    shouldimport = Attribute("""Whether we should import this or not.
267
288
        By 'import' we mean sourcerer analysis resulting in a manifest and a
268
289
        set of Bazaar branches which describe the source package release.
308
329
        """
309
330
 
310
331
 
311
 
class ISourcePackageEdit(Interface):
312
 
    """SourcePackage attributes requiring launchpad.Edit."""
313
 
 
314
 
    # 'pocket' should actually be a PackagePublishingPocket, and 'branch'
315
 
    # should be IBranch, but we use the base classes to avoid circular
316
 
    # imports. Correct interface specific in _schema_circular_imports.
317
 
    @operation_parameters(
318
 
        pocket=Choice(
319
 
            title=_("Pocket"), required=True,
320
 
            vocabulary=DBEnumeratedType),
321
 
        branch=Reference(Interface, title=_("Branch"), required=False))
322
 
    @call_with(registrant=REQUEST_USER)
323
 
    @export_write_operation()
324
 
    def setBranch(pocket, branch, registrant):
325
 
        """Set the official branch for the given pocket of this package.
326
 
 
327
 
        :param pocket: A `PackagePublishingPocket`.
328
 
        :param branch: The branch to set as the official branch.
329
 
        :param registrant: The individual who created this link.
330
 
        :return: None
331
 
        """
332
 
 
333
 
 
334
 
class ISourcePackage(ISourcePackagePublic, ISourcePackageEdit):
335
 
    """A source package associated to a particular distribution series."""
336
 
    export_as_webservice_entry()
337
 
 
338
 
 
339
332
class ISourcePackageFactory(Interface):
340
333
    """A creator of source packages."""
341
334