Changeset 3255
- Timestamp:
- 11/19/07 14:13:38 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/cups.py
r3252 r3255 65 65 def retrieveAttributesFromCUPS(self) : 66 66 """Retrieve attribute's values from CUPS.""" 67 import os68 f = open("/tmp/debug", "w")69 f.write("%s\n" % os.environ.get("CUPS_SERVER", ""))70 f.close()71 67 server = pkipplib.CUPS() # TODO : username and password and/or encryption 72 68 answer = server.getJobAttributes(self.JobId) … … 83 79 (dummy, self.TimeAtProcessing) = self.getAttributeTypeAndValue(answer, "time-at-processing") 84 80 (dummy, self.MimeType) = self.getAttributeTypeAndValue(answer, "document-format") 81 82 for attrib in ("OriginatingUserName", 83 "OriginatingHostName", 84 "Title", 85 "BillingCode", 86 "PrinterName", 87 "Options", 88 "Charset", 89 "UUID", 90 "MimeType") : 91 try : 92 setattr(self, attrib, 93 getattr(self, attrib).decode("UTF-8", "replace")) 94 except AttributeError : 95 pass 96 85 97 self.OriginalUserName = self.OriginatingUserName[:] 86 98 … … 90 102 sys.stderr.write("usage : python cups.py jobid\n") 91 103 else : 92 job = JobTicket(int(sys.argv[1])) 93 for attribute in ("Charset", "JobId", "Copies", "FileName", "OriginatingUserName", 104 job = JobTicket(int(sys.argv[1]), "FakePrinter") 105 for attribute in ("PrinterName", "Charset", "JobId", "Copies", 106 "FileName", "OriginatingUserName", 94 107 "Title", "BillingCode", "OriginatingHostName", 95 "TimeAtCreation", "TimeAtProcessing", "UUID", 108 "TimeAtCreation", "TimeAtProcessing", "UUID", 96 109 "MimeType") : 97 110 sys.stdout.write("%s : %s\n" % (attribute, repr(getattr(job, attribute))))