Show
Ignore:
Timestamp:
06/13/03 21:07:57 (21 years ago)
Author:
jalet
Message:

Two big bugs fixed, time to release something ;-)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1021 r1027  
    2121# 
    2222# $Log$ 
     23# Revision 1.6  2003/06/13 19:07:57  jalet 
     24# Two big bugs fixed, time to release something ;-) 
     25# 
    2326# Revision 1.5  2003/06/10 16:37:54  jalet 
    2427# Deletion of the second user which is not needed anymore. 
     
    134137             
    135138    def getJobHistoryId(self, jobid, userid, printerid) :         
    136         """Returns the history line's id given a (jobid, userid, printerid).""" 
     139        """Returns the history line's id given a (jobid, userid, printerid). 
     140         
     141           TODO : delete because shouldn't be needed by the LDAP backend 
     142        """ 
    137143        raise PyKotaStorageError, "Not implemented !" 
    138144             
     
    344350    def getPrinterPageCounter(self, printerid) : 
    345351        """Returns the last page counter value for a printer given its id, also returns last username, last jobid and history line id.""" 
    346         return # TODO 
    347         result = self.doSearch("objectClass=pykotaPrinterJob", ["pykotaJobHistoryId", "pykotaJobId", "uid", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobDate"], base=printerid) 
    348         if result : 
    349             pass # TODO 
     352        result = self.doSearch("objectClass=pykotaPrinter", ["pykotaPrinterName", "cn"], base=printerid, scope=ldap.SCOPE_BASE) 
     353        if result : 
     354            fields = result[0][1] 
     355            printername = (fields.get("pykotaPrinterName") or fields.get("cn"))[0] 
     356            result = self.doSearch("(&(objectClass=pykotaLastjob)(|(pykotaPrinterName=%s)(cn=%s)))" % (printername, printername), ["pykotaLastJobIdent"]) 
     357            if result : 
     358                lastjobident = result[0][1]["pykotaLastJobIdent"][0] 
     359                result = self.doSearch("(&(objectClass=pykotaJob)(cn=%s))" % lastjobident, ["pykotaUserName", "pykotaPrinterName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "createTimestamp"]) 
     360                if result : 
     361                    pass # TODO 
    350362         
    351363    def addUserToGroup(self, userid, groupid) :