Changeset 3252 for pykota/trunk/pykota/cups.py
- Timestamp:
- 11/03/07 11:09:17 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/cups.py
r3249 r3252 30 30 raise RuntimeError, "The python-pkipplib module is now mandatory. You can download pkipplib from http://www.pykota.com/" 31 31 32 class Job :32 class JobTicket : 33 33 """A class to hold CUPS print job informations.""" 34 def __init__(self, jobid=None, copies=1, filename=None) : 34 def __init__(self, jobid=None, printername=None, copies=1, filename=None, \ 35 options=None) : 35 36 """Initializes a print job's information.""" 36 37 self.JobId = jobid 38 self.PrinterName = printername 37 39 self.Copies = copies 38 40 self.FileName = filename 41 self.Options = options 39 42 self.Charset = None 40 self.UserName = None 43 self.OriginatingUserName = None 44 self.OriginalUserName = None 41 45 self.Title = None 42 46 self.BillingCode = None … … 61 65 def retrieveAttributesFromCUPS(self) : 62 66 """Retrieve attribute's values from CUPS.""" 67 import os 68 f = open("/tmp/debug", "w") 69 f.write("%s\n" % os.environ.get("CUPS_SERVER", "")) 70 f.close() 63 71 server = pkipplib.CUPS() # TODO : username and password and/or encryption 64 72 answer = server.getJobAttributes(self.JobId) … … 66 74 raise PyKotaToolError, "Network error while querying the CUPS server : %s" \ 67 75 % server.lastErrorMessage 68 (dummy, self.Charset) = self.getAttributeTypeAndValue(answer, "attributes-charset", "operation") 69 (dummy, self. UserName) = self.getAttributeTypeAndValue(answer, "job-originating-user-name")76 (dummy, self.Charset) = self.getAttributeTypeAndValue(answer, "attributes-charset", "operation") 77 (dummy, self.OriginatingUserName) = self.getAttributeTypeAndValue(answer, "job-originating-user-name") 70 78 (dummy, self.Title) = self.getAttributeTypeAndValue(answer, "job-name") 71 79 (dummy, self.BillingCode) = self.getAttributeTypeAndValue(answer, "job-billing") … … 75 83 (dummy, self.TimeAtProcessing) = self.getAttributeTypeAndValue(answer, "time-at-processing") 76 84 (dummy, self.MimeType) = self.getAttributeTypeAndValue(answer, "document-format") 85 self.OriginalUserName = self.OriginatingUserName[:] 77 86 78 87 if __name__ == "__main__" : … … 81 90 sys.stderr.write("usage : python cups.py jobid\n") 82 91 else : 83 job = Job (int(sys.argv[1]))84 for attribute in ("Charset", "JobId", "Copies", "FileName", " UserName",92 job = JobTicket(int(sys.argv[1])) 93 for attribute in ("Charset", "JobId", "Copies", "FileName", "OriginatingUserName", 85 94 "Title", "BillingCode", "OriginatingHostName", 86 95 "TimeAtCreation", "TimeAtProcessing", "UUID",