Index: /pykota/trunk/README
===================================================================
--- /pykota/trunk/README (revision 2877)
+++ /pykota/trunk/README (revision 2891)
@@ -369,4 +369,5 @@
       tool is now mandatory for PyKota to work. 
       (http://www.librelogiciel.com/software/)
+    - The pkipplib Python library (http://www.pykota.com/software/pkipplib)  
     - The JAXML Python module to be able to dump datas in the XML format.
       (http://www.librelogiciel.com/software/)
Index: /pykota/trunk/pykota/version.py
===================================================================
--- /pykota/trunk/pykota/version.py (revision 2882)
+++ /pykota/trunk/pykota/version.py (revision 2891)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.25alpha3_unofficial"
+__version__ = "1.25alpha4_unofficial"
 
 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS."
Index: /pykota/trunk/bin/cupspykota
===================================================================
--- /pykota/trunk/bin/cupspykota (revision 2889)
+++ /pykota/trunk/bin/cupspykota (revision 2891)
@@ -47,6 +47,16 @@
 from pykota.tool import PyKotaTool, PyKotaToolError, crashed
 from pykota.accounter import openAccounter
-from pykota.ipp import IPPRequest, IPPError
-        
+# TODO : remove the three lines below and the code which handles
+# TODO : them in a future release.
+from pykota.ipp import IPPRequest as oldIPPRequest
+from pykota.ipp import IPPError as oldIPPError
+
+try :
+    from pkipplib import pkipplib
+except ImportError :        
+    haspkipplib = False
+else :    
+    haspkipplib = True
+    
 class FakeObject :        
     """Fake object."""
@@ -272,13 +282,31 @@
                    (self.myname, self.PrinterName, self.UserName, self.JobId))
         
-        (ippfilename, ippmessage) = self.parseIPPRequestFile()
-        self.ControlFile = ippfilename
-        john = ippmessage.operation_attributes.get("job-originating-host-name", \
-               ippmessage.job_attributes.get("job-originating-host-name", \
-               (None, None)))
+        if not haspkipplib :
+            (ippfilename, ippmessage) = self.parseIPPRequestFile()
+            self.ControlFile = ippfilename
+            john = ippmessage.operation_attributes.get("job-originating-host-name", \
+                   ippmessage.job_attributes.get("job-originating-host-name", \
+                   (None, None)))
+            jbing = ippmessage.job_attributes.get("job-billing", (None, None))
+        else :
+            cupsserver = pkipplib.CUPS(url="http://%s:%s" % \
+                                  (os.environ.get("CUPS_SERVER", "localhost"), \
+                                   os.environ.get("IPP_PORT", "631")))
+            answer = cupsserver.getJobAttributes(self.JobId)
+            self.ControlFile = "NotUsedAnymore"
+            try :
+                john = answer.job["job-originating-host-name"]
+            except KeyError :    
+                try :
+                    john = answer.operation["job-originating-host-name"]
+                except KeyError :    
+                    john = (None, None)
+            try :        
+                jbing = answer.job["job-billing"]
+            except KeyError :    
+                jbing = (None, None)
         if type(john) == type([]) : 
             john = john[-1]
         (chtype, self.ClientHost) = john 
-        jbing = ippmessage.job_attributes.get("job-billing", (None, None))
         if type(jbing) == type([]) : 
             jbing = jbing[-1]
@@ -520,7 +548,7 @@
             self.logdebug("Parsing of IPP request file %s begins." % ippmessagefile)
             try :
-                ippmessage = IPPRequest(ippdatafile.read())
+                ippmessage = oldIPPRequest(ippdatafile.read())
                 ippmessage.parse()
-            except IPPError, msg :    
+            except oldIPPError, msg :    
                 self.printInfo("Error while parsing %s : %s" \
                                       % (ippmessagefile, msg), "warn")
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 2883)
+++ /pykota/trunk/NEWS (revision 2891)
@@ -22,4 +22,9 @@
 PyKota NEWS :
        
+    - 1.25alpha4 (2006-05-22) :
+    
+        - Now uses pkipplib if present to directly retrieve the job
+          information from the CUPS server over IPP.
+          
     - 1.25alpha3 (2006-05-11) :
     
