Changeset 23 for pkipplib/trunk
- Timestamp:
- 06/05/06 23:14:50 (18 years ago)
- Location:
- pkipplib/trunk/pkipplib
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pkipplib/trunk/pkipplib/pkipplib.py
r22 r23 598 598 except (urllib2.URLError, urllib2.HTTPError, socket.error), error : 599 599 self.error = error 600 sys.stderr.write("ERROR : %s\n" % str(error))601 600 return None 602 601 else : … … 617 616 self.charset = charset 618 617 self.language = language 618 self.lastError = None 619 self.lastErrorMessage = None 619 620 620 621 def identifierToURI(self, service, ident) : … … 635 636 return req 636 637 638 def doRequest(self, req) : 639 """Does a request and saves its error status in the lastErrorMessage attribute.""" 640 result = req.doRequest() 641 self.lastError = req.error 642 self.lastErrorMessage = str(req.error) 643 return result 644 637 645 def getDefault(self) : 638 646 """Retrieves CUPS' default printer.""" 639 return self. newRequest(CUPS_GET_DEFAULT).doRequest()647 return self.doRequest(self.newRequest(CUPS_GET_DEFAULT)) 640 648 641 649 def getJobAttributes(self, jobid) : … … 643 651 req = self.newRequest(IPP_GET_JOB_ATTRIBUTES) 644 652 req.operation["job-uri"] = ("uri", self.identifierToURI("jobs", jobid)) 645 return req.doRequest()653 return self.doRequest(req) 646 654 647 655 def getPPD(self, queuename) : … … 651 659 for attrib in ("printer-uri-supported", "printer-type", "member-uris") : 652 660 req.operation["requested-attributes"] = ("nameWithoutLanguage", attrib) 653 return req.doRequest() # TODO : get the PPD from the actual print server661 return self.doRequest(req) # TODO : get the PPD from the actual print server 654 662 655 663 656 664 if __name__ == "__main__" : 657 665 if (len(sys.argv) < 2) or (sys.argv[1] == "--debug") : 658 print "usage : python ipp.py /var/spool/cups/c00005 [--debug] (for example)\n"666 print "usage : python pkipplib.py /var/spool/cups/c00005 [--debug] (for example)\n" 659 667 else : 660 668 infile = open(sys.argv[1], "rb") -
pkipplib/trunk/pkipplib/version.py
r22 r23 21 21 # 22 22 23 __version__ = "0.0 5"23 __version__ = "0.06" 24 24 25 25 __doc__ = "pkipplib : IPP and CUPS support for Python."