Changeset 2913 for pykota/trunk
- Timestamp:
- 06/03/06 00:29:01 (18 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2895 r2913 86 86 self.myname = "cupspykota" 87 87 self.pid = os.getpid() 88 self.DataFile = None 88 89 89 90 def deferredInit(self) : … … 282 283 (self.myname, self.PrinterName, self.UserName, self.JobId)) 283 284 284 if not haspkipplib : 285 connerror = False 286 if haspkipplib : 287 self.ControlFile = "NotUsedAnymore" 288 cupsurl = "http://%s:%s" % \ 289 (os.environ.get("CUPS_SERVER", "localhost"), \ 290 os.environ.get("IPP_PORT", "631")) 291 self.logdebug("Querying CUPS server at %s" % cupsurl) 292 cupsserver = pkipplib.CUPS(url=cupsurl) # TODO : username and password 293 answer = cupsserver.getJobAttributes(self.JobId) 294 if answer is None : 295 self.printInfo(_("Network error while querying the CUPS server at %s (maybe incorrect authentication)") \ 296 % cupsurl, "error") 297 connerror = True 298 else : 299 self.logdebug("CUPS server at %s answered without error." % cupsurl) 300 try : 301 john = answer.job["job-originating-host-name"] 302 except KeyError : 303 try : 304 john = answer.operation["job-originating-host-name"] 305 except KeyError : 306 john = (None, None) 307 try : 308 jbing = answer.job["job-billing"] 309 except KeyError : 310 jbing = (None, None) 311 312 if connerror or not haspkipplib : 285 313 (ippfilename, ippmessage) = self.parseIPPRequestFile() 286 314 self.ControlFile = ippfilename … … 289 317 (None, None))) 290 318 jbing = ippmessage.job_attributes.get("job-billing", (None, None)) 291 else : 292 cupsserver = pkipplib.CUPS(url="http://%s:%s" % \ 293 (os.environ.get("CUPS_SERVER", "localhost"), \ 294 os.environ.get("IPP_PORT", "631"))) 295 answer = cupsserver.getJobAttributes(self.JobId) 296 self.ControlFile = "NotUsedAnymore" 297 try : 298 john = answer.job["job-originating-host-name"] 299 except KeyError : 300 try : 301 john = answer.operation["job-originating-host-name"] 302 except KeyError : 303 john = (None, None) 304 try : 305 jbing = answer.job["job-billing"] 306 except KeyError : 307 jbing = (None, None) 319 308 320 if type(john) == type([]) : 309 321 john = john[-1] … … 480 492 """Cleans up the place.""" 481 493 self.logdebug("Cleaning up...") 494 self.regainPriv() 482 495 self.deinstallSigTermHandler() 483 496 if not self.config.getPrinterKeepFiles(self.PrinterName) : 497 self.logdebug("Work file %s will be deleted." % self.DataFile) 484 498 try : 485 self.logdebug("Work file %s will be deleted." % self.DataFile)486 except AttributeError :487 pass488 else :489 499 os.remove(self.DataFile) 500 except OSError, msg : 501 self.logdebug("Problem while deleting work file %s : %s" % (self.DataFile, msg)) 502 else : 490 503 self.logdebug("Work file %s has been deleted." % self.DataFile) 491 504 else : -
pykota/trunk/NEWS
r2904 r2913 22 22 PyKota NEWS : 23 23 24 - 1.25alpha5 (2006-05-31) : 25 24 - 1.25alpha5 (2006-06-03) : 25 26 - Fixed minor issues with pkipplib's usage. 27 26 28 - Fixed MySQL schema to workaround some "features"... 27 29