~launchpad-pqm/launchpad/devel

8687.15.17 by Karl Fogel
Add the copyright header block to the rest of the files under lib/lp/.
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4983.1.1 by Curtis Hovey
Added lint exceptions to __init__.py and interface/*.py.
4
# pylint: disable-msg=E0211,E0213
2068 by Canonical.com Patch Queue Manager
[r=SteveA/trivial] import fascism, kill translationeffort, kill sshkey browser code, add __all__s to interfaces, other cleanings-up
5
10724.1.2 by Henning Eggers
Second batch done.
6
"""ProjectGroup-related interfaces for Launchpad."""
2068 by Canonical.com Patch Queue Manager
[r=SteveA/trivial] import fascism, kill translationeffort, kill sshkey browser code, add __all__s to interfaces, other cleanings-up
7
8
__metaclass__ = type
9
10
__all__ = [
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
11
    'IProjectGroup',
12
    'IProjectGroupPublic',
13
    'IProjectGroupSeries',
14
    'IProjectGroupSet',
2068 by Canonical.com Patch Queue Manager
[r=SteveA/trivial] import fascism, kill translationeffort, kill sshkey browser code, add __all__s to interfaces, other cleanings-up
15
    ]
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
16
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
17
from lazr.restful.declarations import (
18
    collection_default_content,
19
    export_as_webservice_collection,
20
    export_as_webservice_entry,
21
    export_read_operation,
22
    exported,
23
    operation_parameters,
24
    operation_returns_collection_of,
25
    )
26
from lazr.restful.fields import (
27
    CollectionField,
28
    Reference,
29
    ReferenceChoice,
30
    )
31
from zope.interface import (
32
    Attribute,
33
    Interface,
34
    )
35
from zope.schema import (
36
    Bool,
37
    Datetime,
38
    Int,
39
    Object,
40
    Text,
41
    TextLine,
42
    )
3691.59.9 by Stuart Bishop
Pillar name validators and test fixes
43
44
from canonical.launchpad import _
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
45
from canonical.launchpad.interfaces.launchpad import (
46
    IHasIcon,
47
    IHasLogo,
48
    IHasMugshot,
49
    )
9297.2.14 by Barry Warsaw
Cleanup.
50
from lp.app.interfaces.headings import IRootContext
11664.3.3 by Edwin Grubbs
Don't display bugs or the Report-bug button if Launchpad doesn't know where it tracks bugs.
51
from lp.app.interfaces.launchpad import IServiceUsage
12442.2.9 by j.c.sackett
Ran import reformatter per review.
52
from lp.app.validators.name import name_validator
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
53
from lp.blueprints.interfaces.specificationtarget import IHasSpecifications
54
from lp.blueprints.interfaces.sprint import IHasSprints
55
from lp.bugs.interfaces.bugtarget import (
56
    IHasBugs,
57
    IHasOfficialBugTags,
58
    )
59
from lp.bugs.interfaces.bugtracker import IBugTracker
7675.1025.1 by Gary Poster
structural subscriptions are moved from registry to bugs. moved tests pass.
60
from lp.bugs.interfaces.structuralsubscription import (
61
    IStructuralSubscriptionTarget,
62
    )
8138.1.2 by Jonathan Lange
Run migrater over lp.code. Many tests broken and imports failing.
63
from lp.code.interfaces.branchvisibilitypolicy import (
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
64
    IHasBranchVisibilityPolicy,
65
    )
66
from lp.code.interfaces.hasbranches import (
67
    IHasBranches,
68
    IHasMergeProposals,
69
    )
70
from lp.registry.interfaces.announcement import IMakesAnnouncements
7675.110.3 by Curtis Hovey
Ran the migration script to move registry code to lp.registry.
71
from lp.registry.interfaces.karma import IKarmaContext
72
from lp.registry.interfaces.milestone import (
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
73
    ICanGetMilestonesDirectly,
74
    IHasMilestones,
75
    )
7675.110.3 by Curtis Hovey
Ran the migration script to move registry code to lp.registry.
76
from lp.registry.interfaces.pillar import IPillar
13130.1.7 by Curtis Hovey
Updated imports of IHasDriver.
77
from lp.registry.interfaces.role import (
78
    IHasAppointedDriver,
79
    IHasDrivers,
80
    IHasOwner,
81
    )
11318.5.1 by j.c.sackett
Migrated canonical.launchpad.fields to lp.services.fields
82
from lp.services.fields import (
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
83
    IconImageUpload,
84
    LogoImageUpload,
85
    MugshotImageUpload,
86
    PillarNameField,
87
    PublicPersonChoice,
88
    Summary,
89
    Title,
90
    URIField,
91
    )
7675.916.98 by Henning Eggers
Merged db-stable at r10026 (recife roll-back) but without accepting the changes.
92
from lp.translations.interfaces.translationpolicy import ITranslationPolicy
6327.12.5 by Francis J. Lacoste
Made IProject, IProduct, IProductSeries, IProductRelease, IMilestone available on the web service.
93
3691.59.9 by Stuart Bishop
Pillar name validators and test fixes
94
95
class ProjectNameField(PillarNameField):
2920.2.2 by Diogo Matsubara
Fixes https://launchpad.net/products/launchpad/+bug/3436 (no sensible error message when adding a spec which has already been added.) and fixes https://launchpad.net/products/launchpad/+bug/4122 (The docstring of ISpecification is incorrect)
96
97
    @property
98
    def _content_iface(self):
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
99
        return IProjectGroup
100
101
11403.2.1 by Brad Crittenden
Changed attribute permissions to allow registry experts to edit them
102
class IProjectGroupModerate(IPillar):
103
    """IProjectGroup attributes used with launchpad.Moderate permission."""
104
    reviewed = exported(
105
        Bool(
106
            title=_('Reviewed'), required=False,
107
            description=_("Whether or not this project group has been "
108
                          "reviewed.")))
12041.2.1 by Brad Crittenden
Move ProjectGroup name attribute to launchpad.Moderate to allow registry experts to edit it. By necessity owners will lose the edit capability on name.
109
    name = exported(
110
        ProjectNameField(
111
            title=_('Name'),
112
            required=True,
113
            description=_(
114
                "A unique name, used in URLs, identifying the project "
115
                "group.  All lowercase, no special characters. "
116
                "Examples: apache, mozilla, gimp."),
117
            constraint=name_validator))
11403.2.1 by Brad Crittenden
Changed attribute permissions to allow registry experts to edit them
118
119
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
120
class IProjectGroupPublic(
9206.1.2 by William Grant
Move IProject's contents to a new IProjectPublic, and set security on the new interface.
121
    ICanGetMilestonesDirectly, IHasAppointedDriver, IHasBranches, IHasBugs,
122
    IHasDrivers, IHasBranchVisibilityPolicy, IHasIcon, IHasLogo,
11822.2.1 by Robert Collins
Remove the python code related to mentoring.
123
    IHasMergeProposals, IHasMilestones, IHasMugshot,
10089.2.1 by Adi Roiban
Initial fix. Pagetest needed.
124
    IHasOwner, IHasSpecifications, IHasSprints, IMakesAnnouncements,
11664.3.3 by Edwin Grubbs
Don't display bugs or the Report-bug button if Launchpad doesn't know where it tracks bugs.
125
    IKarmaContext, IRootContext, IHasOfficialBugTags, IServiceUsage):
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
126
    """Public IProjectGroup properties."""
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
127
128
    id = Int(title=_('ID'), readonly=True)
1192 by Canonical.com Patch Queue Manager
Cleaner DocStrings for Project/Product name and requested improves in browser/product.py
129
6928.1.6 by Leonard Richardson
Response to feedback.
130
    owner = exported(
131
        PublicPersonChoice(
132
            title=_('Maintainer'),
133
            required=True,
134
            vocabulary='ValidOwner',
135
            description=_("Project group owner. Must be either a "
136
                          "Launchpad Person or Team.")))
2068 by Canonical.com Patch Queue Manager
[r=SteveA/trivial] import fascism, kill translationeffort, kill sshkey browser code, add __all__s to interfaces, other cleanings-up
137
6928.1.6 by Leonard Richardson
Response to feedback.
138
    registrant = exported(
139
        PublicPersonChoice(
140
            title=_('Registrant'),
141
            required=True,
142
            readonly=True,
143
            vocabulary='ValidPersonOrTeam',
144
            description=_("Project group registrant. Must be a valid "
145
                          "Launchpad Person.")))
6786.2.4 by Brad Crittenden
Added registrant to product and project and created ValidPersonVocabulary.
146
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
147
    displayname = exported(
148
        TextLine(
149
            title=_('Display Name'),
150
            description=_(
6928.1.6 by Leonard Richardson
Response to feedback.
151
                "Appropriately capitalised, "
152
                'and typically ending in "Project". '
153
                "Examples: the Apache Project, the Mozilla Project, "
154
                "the Gimp Project.")),
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
155
        exported_as="display_name")
2208 by Canonical.com Patch Queue Manager
[trivial] Improve descriptions in registry interfaces
156
6928.1.6 by Leonard Richardson
Response to feedback.
157
    title = exported(
158
        Title(
159
            title=_('Title'),
160
            description=_("The full name of the project group, "
161
                          "which can contain spaces, special characters, "
162
                          "etc.")))
163
164
    summary = exported(
165
        Summary(
166
            title=_('Project Group Summary'),
167
            description=_(
10568.3.4 by Curtis Hovey
Revised the description of the pillar/person summary and decription/homepage_content fields to explain that URLs are linked in pages.
168
                "A short paragraph to introduce the project group's work.")))
6928.1.6 by Leonard Richardson
Response to feedback.
169
170
    description = exported(
171
        Text(
172
            title=_('Description'),
10568.3.4 by Curtis Hovey
Revised the description of the pillar/person summary and decription/homepage_content fields to explain that URLs are linked in pages.
173
            description=_(
174
                "Details about the project group's work, goals, and "
175
                "how to contribute. Use plain text, paragraphs are preserved "
176
                "and URLs are linked in pages. Don't repeat the Summary.")))
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
177
178
    datecreated = exported(
7107.4.2 by Leonard Richardson
Implemented named GET operations.
179
        Datetime(
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
180
            title=_('Date Created'),
181
            description=_(
6928.1.6 by Leonard Richardson
Response to feedback.
182
                "The date this project group was created in Launchpad."),
183
            readonly=True),
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
184
        exported_as="date_created")
185
6928.1.6 by Leonard Richardson
Response to feedback.
186
    driver = exported(
187
        PublicPersonChoice(
188
            title=_("Driver"),
189
            description=_(
190
                "This is a project group-wide appointment. Think carefully "
191
                "here! This person or team will be able to set feature goals "
192
                "and approve bug targeting and backporting for ANY series in "
193
                "ANY project in this group. You can also appoint drivers "
194
                "at the level of a specific project or series. So you may "
195
                "just want to leave this space blank, and instead let the "
196
                "individual projects and series have drivers."),
197
            required=False, vocabulary='ValidPersonOrTeam'))
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
198
199
    homepageurl = exported(
200
        URIField(
201
            title=_('Homepage URL'),
202
            required=False,
6928.1.6 by Leonard Richardson
Response to feedback.
203
            allowed_schemes=['http', 'https', 'ftp'],
204
            allow_userinfo=False,
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
205
            description=_(
6928.1.6 by Leonard Richardson
Response to feedback.
206
                "The project group home page. "
207
                "Please include the http://")),
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
208
        exported_as="homepage_url")
209
210
    wikiurl = exported(
211
        URIField(
212
            title=_('Wiki URL'),
213
            required=False,
6928.1.6 by Leonard Richardson
Response to feedback.
214
            allowed_schemes=['http', 'https', 'ftp'],
215
            allow_userinfo=False,
216
            description=_("The URL of this project group's wiki, "
217
                          "if it has one. Please include the http://")),
10568.3.6 by Curtis Hovey
Hush lint.
218
        exported_as="wiki_url")
2208 by Canonical.com Patch Queue Manager
[trivial] Improve descriptions in registry interfaces
219
220
    lastdoap = TextLine(
2281 by Canonical.com Patch Queue Manager
[r=spiv] Change all DOAP to Registry, including urls
221
        title=_('Last-parsed RDF fragment'),
6928.1.6 by Leonard Richardson
Response to feedback.
222
        description=_("The last RDF fragment for this "
223
                      "entity that we received and parsed, or "
224
                      "generated."),
2208 by Canonical.com Patch Queue Manager
[trivial] Improve descriptions in registry interfaces
225
        required=False)
226
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
227
    sourceforgeproject = exported(
228
        TextLine(
229
            title=_("SourceForge Project Name"),
6928.1.6 by Leonard Richardson
Response to feedback.
230
            description=_("The SourceForge project name for this "
231
                          "project group, if it is in SourceForge."),
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
232
            required=False),
233
        exported_as="sourceforge_project")
2208 by Canonical.com Patch Queue Manager
[trivial] Improve descriptions in registry interfaces
234
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
235
    freshmeatproject = exported(
236
        TextLine(
237
            title=_("Freshmeat Project Name"),
6928.1.6 by Leonard Richardson
Response to feedback.
238
            description=_("The Freshmeat project name for this "
239
                          "project group, if it is in Freshmeat."),
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
240
            required=False),
241
        exported_as="freshmeat_project")
242
6928.1.6 by Leonard Richardson
Response to feedback.
243
    homepage_content = exported(
244
        Text(
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
245
            title=_("Homepage Content"), required=False,
246
            description=_(
6928.1.3 by Leonard Richardson
Delinted.
247
                "The content of this project group's home page. Edit this "
248
                "and it will be displayed for all the world to see. It is "
249
                "NOT a wiki so you cannot undo changes.")))
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
250
6928.1.6 by Leonard Richardson
Response to feedback.
251
    icon = exported(
252
        IconImageUpload(
253
            title=_("Icon"), required=False,
254
            default_image_resource='/@@/project',
255
            description=_(
256
                "A small image of exactly 14x14 pixels and at most 5kb in "
257
                "size, that can be used to identify this project group. The "
258
                "icon will be displayed in Launchpad everywhere that we link "
259
                "to this project group. For example in listings or tables of "
260
                "active project groups.")))
261
262
    logo = exported(
263
        LogoImageUpload(
264
            title=_("Logo"), required=False,
265
            default_image_resource='/@@/project-logo',
266
            description=_(
267
                "An image of exactly 64x64 pixels that will be displayed in "
268
                "the heading of all pages related to this project group. It "
269
                "should be no bigger than 50kb in size.")))
270
271
    mugshot = exported(
272
        MugshotImageUpload(
273
            title=_("Brand"), required=False,
274
            default_image_resource='/@@/project-mugshot',
275
            description=_(
276
                "A large image of exactly 192x192 pixels, that will be "
277
                "displayed on this project group's home page in Launchpad. "
278
                "It should be no bigger than 100kb in size. ")))
3691.262.1 by Guilherme Salgado
Add homepage_content, emblem and gotchi columns everywhere
279
6928.1.4 by Leonard Richardson
Exported bugtracker.
280
    bugtracker = exported(
10454.3.9 by James Westby
Fix various exports to use ReferenceChoice to export correctly.
281
        ReferenceChoice(title=_('Bug Tracker'), required=False,
282
               vocabulary='BugTracker', schema=IBugTracker,
6928.1.4 by Leonard Richardson
Exported bugtracker.
283
               description=_(
284
                "The bug tracker the projects in this project group use.")),
285
        exported_as="bug_tracker")
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
286
6928.1.1 by Leonard Richardson
Exposed fields on project groups.
287
    # products.value_type will be set to IProduct once IProduct is defined.
288
    products = exported(
289
        CollectionField(
290
            title=_('List of active projects for this project group.'),
291
            value_type=Reference(Interface)),
292
        exported_as="projects")
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
293
7368.5.16 by Gavin Panella
Expose bug_reporting_guidelines for product groups too.
294
    bug_reporting_guidelines = exported(
7368.5.19 by Gavin Panella
Post-review fixes.
295
        Text(
10469.1.6 by Edwin Grubbs
Fixed problems with project groups.
296
            title=(
297
                u"If I\N{right single quotation mark}m reporting a bug, "
298
                u"I should include, if possible"),
7368.5.19 by Gavin Panella
Post-review fixes.
299
            description=(
7368.5.16 by Gavin Panella
Expose bug_reporting_guidelines for product groups too.
300
                u"These guidelines will be shown to "
10469.1.6 by Edwin Grubbs
Fixed problems with project groups.
301
                "anyone reporting a bug."),
7368.5.19 by Gavin Panella
Post-review fixes.
302
            required=False,
303
            max_length=50000))
6882.2.39 by Tom Berger
Project is not an IBugTarget, but it still needs bug_reporting_guidelines.
304
7675.712.1 by Tom Berger
model for bug_acknowledgement_message
305
    bug_reported_acknowledgement = exported(
306
        Text(
307
            title=(
308
                u"After reporting a bug, I can expect the following."),
309
            description=(
310
                u"This message of acknowledgement will be displayed "
311
                "to anyone after reporting a bug."),
312
            required=False,
313
            max_length=50000))
314
7675.989.1 by Abel Deuring
property enable_bugfiling_duplicate_search added to bug target model classes.
315
    enable_bugfiling_duplicate_search = Bool(
316
        title=u"Search for possible duplicate bugs when a new bug is filed",
317
        required=False, readonly=True)
318
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
319
    def getProduct(name):
320
        """Get a product with name `name`."""
321
11692.10.20 by j.c.sackett
Fixed another test.
322
    def getConfigurableProducts():
11692.10.14 by j.c.sackett
Added project listing WITH permission controls.
323
        """Get all products that can be edited by user."""
324
3755.3.1 by Carlos Perello Marin
Added a +translations page for IProject objects and activated 'translations' facet for IProject. Fixes bug #73875
325
    def translatables():
326
        """Return an iterator over products that have resources translatables.
327
328
        It also should have IProduct.official_rosetta flag set.
329
        """
330
11668.2.5 by j.c.sackett
Fixes from review.
331
    def has_translatable():
11668.2.1 by j.c.sackett
Added a has_translatables flag on projectgroups, used to determine whether or not to override the ProjectGroup involvement menu code.
332
        """Return a boolean showing the existance of translatables products.
333
        """
334
11692.10.11 by j.c.sackett
Fixed broken tests.
335
    def has_branches():
11692.10.2 by j.c.sackett
Added has_branches property to projecgroup.
336
        """Return a boolean showing the existance of products with branches.
337
        """
11692.10.8 by j.c.sackett
Fixed test.
338
4508.3.9 by Graham Binns
Fixes and tidy-ups in accordance with Kiko's review comments
339
    def hasProducts():
4508.3.10 by Graham Binns
Typo fix
340
        """Returns True if a project has products associated with it, False
341
        otherwise.
342
        """
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
343
5283.6.2 by Abel Deuring
implemented reviewer's comments
344
    def getSeries(series_name):
10724.1.3 by Henning Eggers
Some left-overs.
345
        """Return a ProjectGroupSeries object with name `series_name`."""
5283.6.2 by Abel Deuring
implemented reviewer's comments
346
11582.2.5 by Robert Collins
Fix up test fallout.
347
    product_milestones = Attribute('all the milestones for all the products.')
348
4606.1.1 by Abel Deuring
bug 116454: implemented reviewer's comments; trunk merged
349
11403.2.1 by Brad Crittenden
Changed attribute permissions to allow registry experts to edit them
350
class IProjectGroup(IProjectGroupPublic,
351
                    IProjectGroupModerate,
352
                    IStructuralSubscriptionTarget,
353
                    ITranslationPolicy):
10724.1.2 by Henning Eggers
Second batch done.
354
    """A ProjectGroup."""
9206.1.2 by William Grant
Move IProject's contents to a new IProjectPublic, and set security on the new interface.
355
356
    export_as_webservice_entry('project_group')
357
358
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
359
# Interfaces for set
360
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
361
class IProjectGroupSet(Interface):
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
362
    """The collection of projects."""
363
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
364
    export_as_webservice_collection(IProjectGroup)
6928.2.1 by Leonard Richardson
Basic implementation of projectgroup collection.
365
1382 by Canonical.com Patch Queue Manager
new page layout
366
    title = Attribute('Title')
367
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
368
    def __iter__():
369
        """Return an iterator over all the projects."""
370
371
    def __getitem__(name):
372
        """Get a project by its name."""
373
2920.2.2 by Diogo Matsubara
Fixes https://launchpad.net/products/launchpad/+bug/3436 (no sensible error message when adding a spec which has already been added.) and fixes https://launchpad.net/products/launchpad/+bug/4122 (The docstring of ISpecification is incorrect)
374
    def get(projectid):
2354 by Canonical.com Patch Queue Manager
[r=bjornt] Product and Project vocabularies should not contain inactive entries. Bug#1873
375
        """Get a project by its id.
376
2976.10.15 by Stuart Bishop
zope.exceptions.NotFoundError is deprecated
377
        If the project can't be found a NotFoundError will be raised.
2354 by Canonical.com Patch Queue Manager
[r=bjornt] Product and Project vocabularies should not contain inactive entries. Bug#1873
378
        """
379
2920.2.2 by Diogo Matsubara
Fixes https://launchpad.net/products/launchpad/+bug/3436 (no sensible error message when adding a spec which has already been added.) and fixes https://launchpad.net/products/launchpad/+bug/4122 (The docstring of ISpecification is incorrect)
380
    def getByName(name, default=None, ignore_inactive=False):
381
        """Return the project with the given name, ignoring inactive projects
382
        if ignore_inactive is True.
4005.1.3 by Mark Shuttleworth
Make icon, logo and mugshot entirely orthogonal
383
2920.2.2 by Diogo Matsubara
Fixes https://launchpad.net/products/launchpad/+bug/3436 (no sensible error message when adding a spec which has already been added.) and fixes https://launchpad.net/products/launchpad/+bug/4122 (The docstring of ISpecification is incorrect)
384
        Return the default value if there is no such project.
385
        """
386
3691.339.8 by Guilherme Salgado
Use the new image-widget for projects/distributions/sprints
387
    def new(name, displayname, title, homepageurl, summary, description,
6786.2.6 by Brad Crittenden
Changes per review comments.
388
            owner, mugshot=None, logo=None, icon=None, registrant=None):
389
        """Create and return a project with the given arguments.
390
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
391
        For a description of the parameters see `IProjectGroup`.
6786.2.6 by Brad Crittenden
Changes per review comments.
392
        """
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
393
2296.1.10 by Matthew Thomas
replace repetitive 'help' text on /products and /projects with useful stats
394
    def count_all():
395
        """Return the total number of projects registered in Launchpad."""
396
6928.2.1 by Leonard Richardson
Basic implementation of projectgroup collection.
397
    @collection_default_content()
6928.2.5 by Leonard Richardson
Removed default value for required argument.
398
    @operation_parameters(text=TextLine(title=_("Search text")))
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
399
    @operation_returns_collection_of(IProjectGroup)
6928.2.2 by Leonard Richardson
Exported the search and create methods.
400
    @export_read_operation()
11996.2.3 by j.c.sackett
Updated the interface.
401
    def search(text=None, search_products=False):
2281 by Canonical.com Patch Queue Manager
[r=spiv] Change all DOAP to Registry, including urls
402
        """Search through the Registry database for projects that match the
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
403
        query terms. text is a piece of text in the title / summary /
404
        description fields of project (and possibly product). soyuz,
1062 by Canonical.com Patch Queue Manager
bazaar renaming and initial soyuz refactoring for distribution, distrorelease
405
        bazaar, malone etc are hints as to whether the search should
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
406
        be limited to projects that are active in those Launchpad
407
        applications."""
408
409
    def forReview():
10724.1.2 by Henning Eggers
Second batch done.
410
        """Return a list of ProjectGroups which need review, or which have
1102 by Canonical.com Patch Queue Manager
Lucille had some XXXs which should have been NOTEs
411
        products that needs review."""
412
5283.6.1 by Abel Deuring
Implementation of a view for series-related blueprints of projects.
413
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
414
class IProjectGroupSeries(IHasSpecifications, IHasAppointedDriver, IHasIcon,
5283.6.3 by Abel Deuring
implemented reviewer's comments
415
                     IHasOwner):
10724.1.2 by Henning Eggers
Second batch done.
416
    """Interface for ProjectGroupSeries.
5283.6.1 by Abel Deuring
Implementation of a view for series-related blueprints of projects.
417
418
    This class provides the specifications related to a "virtual project
5283.6.5 by Abel Deuring
RF merge; implemented reviewer's comments
419
    series", i.e., to those specifactions that are assigned to a series
5283.6.1 by Abel Deuring
Implementation of a view for series-related blueprints of projects.
420
    of a product which is part of this project.
421
    """
5283.6.5 by Abel Deuring
RF merge; implemented reviewer's comments
422
    name = TextLine(title=u'The name of the product series.',
423
                    required=True, readonly=True,
424
                    constraint=name_validator)
425
426
    displayname = TextLine(title=u'Alias for name.',
427
                           required=True, readonly=True,
428
                           constraint=name_validator)
429
6080.9.9 by Edwin Grubbs
Fixed lint warnings
430
    title = TextLine(title=u'The title for this project series.',
431
                     required=True, readonly=True)
5283.6.5 by Abel Deuring
RF merge; implemented reviewer's comments
432
10326.1.1 by Henning Eggers
Mechanically renamed IProject* to IProjectGroup*.
433
    project = Object(schema=IProjectGroup,
5283.6.5 by Abel Deuring
RF merge; implemented reviewer's comments
434
                     title=u"The project this series belongs to",
435
                     required=True, readonly=True)