Show
Ignore:
Timestamp:
05/17/05 22:24:40 (19 years ago)
Author:
jerome
Message:

Integrated the major rewrite of ipp.py into PyKota.
Now the job-originating-hostname is correctly retrieved
in all cases I've seen.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r2239 r2254  
    4040from pykota.storage import PyKotaStorageError 
    4141from pykota.accounter import PyKotaAccounterError 
    42 from pykota.ipp import IPPMessage, PyKotaIPPError 
     42from pykota.ipp import IPPMessage, IPPError 
    4343     
    4444class PyKotaPopen4(popen2.Popen4) : 
     
    215215                ippdatafile.close() 
    216216            self.dropPriv()     
    217             clienthost = ippmessage.get("job-originating-host-name")  
    218             billingcode = ippmessage.get("job-billing") 
     217             
     218            try : 
     219                (chtype, clienthost) = ippmessage.operation_attributes.get("job-originating-host-name", \ 
     220                                          ippmessage.job_attributes.get("job-originating-host-name", (None, None))) 
     221                (jbtype, billingcode) = ippmessage.job_attributes.get("job-billing", (None, None)) 
     222            except AttributeError :     
     223                clienthost = None 
     224                billingcode = None 
    219225            if clienthost is None : 
    220226                (billingcode, clienthost) = self.getJobInfosFromPageLog(cupsdconf, printer.Name, user.Name, self.jobid) 
    221227            self.logdebug("Client Hostname : %s" % (clienthost or "Unknown"))     
    222228            self.logdebug("Billing Code : %s" % (billingcode or "None"))     
     229             
    223230            os.environ["PYKOTAJOBORIGINATINGHOSTNAME"] = str(clienthost or "") 
    224231            os.environ["PYKOTAJOBBILLING"] = str(billingcode or "")