~ursinha/launchpad/add-all-fl-tests

« back to all changes in this revision

Viewing changes to lib/canonical/launchpad/browser/hwdb.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2009-08-20 12:36:07 UTC
  • mfrom: (9094.2.2 hwdb-device-class-api)
  • Revision ID: launchpad@pqm.canonical.com-20090820123607-w7k7ahwkclxlonh8
[r=cprov][ui=none] allow arbitrary int values for
        HWDeviceClass.main_class and HWDeviceClass.sub_class;
        expose HWDeviceClass to the webservice

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from lp.registry.interfaces.distribution import IDistributionSet
24
24
from canonical.launchpad.interfaces.launchpad import ILaunchBag, NotFoundError
25
25
from canonical.launchpad.interfaces.hwdb import (
26
 
    HWSubmissionMissingFields, IHWDBApplication, IHWDeviceSet, IHWDriverSet,
27
 
    IHWSubmissionDeviceSet, IHWSubmissionForm, IHWSubmissionSet,
28
 
    IHWSystemFingerprintSet, IHWVendorIDSet)
 
26
    HWSubmissionMissingFields, IHWDBApplication, IHWDeviceClassSet,
 
27
    IHWDeviceSet, IHWDriverSet, IHWSubmissionDeviceSet, IHWSubmissionForm,
 
28
    IHWSubmissionSet, IHWSystemFingerprintSet, IHWVendorIDSet)
29
29
from canonical.launchpad.webapp import (
30
30
    action, LaunchpadView, LaunchpadFormView, Navigation, stepthrough)
31
31
from canonical.launchpad.webapp.batching import BatchNavigator
218
218
            raise NotFoundError('invalid value for ID: %r' % id)
219
219
        return getUtility(IHWDeviceSet).getByID(id)
220
220
 
 
221
    @stepthrough('+deviceclass')
 
222
    def traverse_device_class(self, id):
 
223
        try:
 
224
            id = int(id)
 
225
        except ValueError:
 
226
            raise NotFoundError('invalid value for ID: %r' % id)
 
227
        return getUtility(IHWDeviceClassSet).get(id)
 
228
 
221
229
    @stepthrough('+driver')
222
230
    def traverse_driver(self, id):
223
231
        try: