~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/hardwaredb/interfaces/hwdb.py

  • Committer: Francis J. Lacoste
  • Date: 2011-06-16 20:12:00 UTC
  • mto: This revision was merged to the branch mainline in revision 13262.
  • Revision ID: francis.lacoste@canonical.com-20110616201200-ejqty2lhkox20if5
Lint blows but hoover sucks

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
            'Submission key already exists.')
108
108
    return True
109
109
 
 
110
 
110
111
def validate_email_address(emailaddress):
111
112
    """Validate an email address.
112
113
 
118
119
            'Invalid email address')
119
120
    return True
120
121
 
 
122
 
121
123
class HWSubmissionKeyNotUnique(Exception):
122
124
    """Prevent two or more submission with identical submission_key."""
123
125
 
147
149
        The submitted data has been processed.
148
150
        """)
149
151
 
 
152
 
150
153
class HWSubmissionFormat(DBEnumeratedType):
151
154
    """The format version of the submitted data."""
152
155
 
433
436
 
434
437
        Return the new entry."""
435
438
 
 
439
 
436
440
class IHWDriver(Interface):
437
441
    """Information about a device driver."""
438
442
    export_as_webservice_entry(publish_web_link=False)
457
461
        Choice(
458
462
            title=u'License of the Driver', required=False,
459
463
            vocabulary=License))
 
464
 
460
465
    @operation_parameters(
461
466
        distribution=Reference(
462
467
            IDistribution,
463
468
            title=u'A Distribution',
464
 
            description=
 
469
            description=(
465
470
                u'If specified, the result set is limited to sumbissions '
466
 
                'made for the given distribution.',
 
471
                'made for the given distribution.'),
467
472
            required=False),
468
473
        distroseries=Reference(
469
474
            IDistroSeries,
470
475
            title=u'A Distribution Series',
471
 
            description=
 
476
            description=(
472
477
                u'If specified, the result set is limited to sumbissions '
473
 
                'made for the given distribution series.',
 
478
                'made for the given distribution series.'),
474
479
            required=False),
475
 
        architecture = TextLine(
 
480
        architecture=TextLine(
476
481
            title=u'A processor architecture',
477
 
            description=
 
482
            description=(
478
483
                u'If specified, the result set is limited to sumbissions '
479
 
                'made for the given architecture.',
 
484
                'made for the given architecture.'),
480
485
            required=False),
481
 
        owner = copy_field(IHWSubmission['owner']))
 
486
        owner=copy_field(IHWSubmission['owner']))
482
487
    @operation_returns_collection_of(IHWSubmission)
483
488
    @export_read_operation()
484
489
    def getSubmissions(distribution=None, distroseries=None,
814
819
        driver=Reference(
815
820
            IHWDriver,
816
821
            title=u'A driver used for this device in a submission',
817
 
            description=
 
822
            description=(
818
823
                u'If specified, the result set is limited to sumbissions '
819
824
                'made for the given distribution, distroseries or '
820
 
                'distroarchseries.',
 
825
                'distroarchseries.'),
821
826
            required=False),
822
827
        distribution=Reference(
823
828
            IDistribution,
824
829
            title=u'A Distribution',
825
 
            description=
 
830
            description=(
826
831
                u'If specified, the result set is limited to sumbissions '
827
 
                'made for the given distribution.',
 
832
                'made for the given distribution.'),
828
833
            required=False),
829
834
        distroseries=Reference(
830
835
            IDistroSeries,
831
836
            title=u'A Distribution Series',
832
 
            description=
 
837
            description=(
833
838
                u'If specified, the result set is limited to sumbissions '
834
 
                'made for the given distribution series.',
 
839
                'made for the given distribution series.'),
835
840
            required=False),
836
 
        architecture = TextLine(
 
841
        architecture=TextLine(
837
842
            title=u'A processor architecture',
838
 
            description=
839
 
                u'If specified, the result set is limited to sumbissions '
840
 
                'made for the given architecture.',
 
843
            description=(
 
844
                u'If specified, the result set is limited to submissions '
 
845
                'made for the given architecture.'),
841
846
            required=False),
842
 
        owner = copy_field(IHWSubmission['owner']))
 
847
        owner=copy_field(IHWSubmission['owner']))
843
848
    @operation_returns_collection_of(IHWSubmission)
844
849
    @export_read_operation()
845
850
    def getSubmissions(driver=None, distribution=None,
1191
1196
        package_name=TextLine(
1192
1197
            title=u'The name of the package containing the driver.',
1193
1198
            required=False,
1194
 
            description=
 
1199
            description=(
1195
1200
                u'If package_name is omitted, all driver records '
1196
1201
                'returned, optionally limited to those matching the '
1197
1202
                'parameter name. If package_name is '' (empty string), '
1198
1203
                'those records are returned where package_name is '' or '
1199
 
                'None.'),
 
1204
                'None.')),
1200
1205
        name=TextLine(
1201
1206
            title=u'The name of the driver.', required=False,
1202
 
            description=
 
1207
            description=(
1203
1208
                u'If name is omitted, all driver records are '
1204
1209
                'returned, optionally limited to those matching the '
1205
 
                'parameter package_name.'))
 
1210
                'parameter package_name.')))
1206
1211
    @operation_returns_collection_of(IHWDriver)
1207
1212
    @export_read_operation()
1208
1213
    def drivers(package_name=None, name=None):
1223
1228
    driver_names = exported(
1224
1229
        CollectionField(
1225
1230
            title=u'Driver Names',
1226
 
            description=
1227
 
                u'All known distinct driver names appearing in HWDriver',
 
1231
            description=(
 
1232
                u'All known distinct driver names appearing in HWDriver'),
1228
1233
            value_type=Reference(schema=IHWDriverName),
1229
1234
            readonly=True))
1230
1235
 
1231
1236
    package_names = exported(
1232
1237
        CollectionField(
1233
1238
            title=u'Package Names',
1234
 
            description=
1235
 
                u'All known distinct package names appearing in HWDriver.',
 
1239
            description=(
 
1240
                u'All known distinct package names appearing in '
 
1241
                'HWDriver.'),
1236
1242
            value_type=Reference(schema=IHWDriverPackageName),
1237
1243
            readonly=True))
1238
1244