Changeset 3420

Show
Ignore:
Timestamp:
10/04/08 10:49:42 (16 years ago)
Author:
jerome
Message:

Don't ask for unnecessary printer attributes : we only need the
device-uri, so we don't need to waste bandwidth to retrieve other
attributes, especially when we've got a huge number of printers.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkprinters

    r3418 r3420  
    6464        req = cups.newRequest(pkipplib.IPP_GET_PRINTER_ATTRIBUTES) 
    6565        req.operation["printer-uri"] = ("uri", cups.identifierToURI("printers", printername)) 
     66        req.operation["requested-attributes"] = ("keyword", "device-uri") 
    6667        try : 
    6768            return cups.doRequest(req).printer["device-uri"][0][1] 
    68         except : 
     69        except (AttributeError, IndexError) : 
    6970            self.printInfo(_("Impossible to retrieve %(printername)s's DeviceURI") % locals(), "warn") 
    7071            return ""