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 : |
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 | |