Show
Ignore:
Timestamp:
04/20/05 13:18:36 (19 years ago)
Author:
jerome
Message:

Fixed incomplete history retrieval from LDAP

Files:
1 modified

Legend:

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

    r2191 r2211  
    490490            result = None 
    491491            try : 
    492                 result = self.doSearch("objectClass=pykotaJob", ["pykotaJobSizeBytes", "pykotaHostName", "pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "pykotaBillingCode", "pykotaPages", "pykotaMD5Sum", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE) 
     492                result = self.doSearch("objectClass=pykotaJob", [ "pykotaJobSizeBytes",  
     493                                                                  "pykotaHostName",  
     494                                                                  "pykotaUserName",  
     495                                                                  "pykotaPrinterName",  
     496                                                                  "pykotaJobId",  
     497                                                                  "pykotaPrinterPageCounter",  
     498                                                                  "pykotaJobSize",  
     499                                                                  "pykotaAction",  
     500                                                                  "pykotaJobPrice",  
     501                                                                  "pykotaFileName",  
     502                                                                  "pykotaTitle",  
     503                                                                  "pykotaCopies",  
     504                                                                  "pykotaOptions",  
     505                                                                  "pykotaBillingCode",  
     506                                                                  "pykotaPages",  
     507                                                                  "pykotaMD5Sum",  
     508                                                                  "createTimestamp" ],  
     509                                                                base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE) 
    493510            except PyKotaStorageError :     
    494511                pass # Last job entry exists, but job probably doesn't exist anymore.  
     
    514531                lastjob.JobHostName = fields.get("pykotaHostName", [""])[0] 
    515532                lastjob.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0] 
    516                 lastjob.JobBillingCode = fields.get("pykotaMD5Sum", [None])[0] 
     533                lastjob.JobBillingCode = fields.get("pykotaBillingCode", [None])[0] 
    517534                lastjob.JobMD5Sum = fields.get("pykotaMD5Sum", [None])[0] 
    518535                lastjob.JobPages = fields.get("pykotaPages", [""])[0] 
     
    10331050            where = precond 
    10341051        jobs = []     
    1035         result = self.doSearch(where, fields=["pykotaJobSizeBytes", "pykotaHostName", "pykotaUserName", "pykotaPrinterName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaAction", "pykotaJobSize", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base=self.info["jobbase"]) 
     1052        result = self.doSearch(where, fields=[ "pykotaJobSizeBytes",  
     1053                                               "pykotaHostName",  
     1054                                               "pykotaUserName",  
     1055                                               "pykotaPrinterName",  
     1056                                               "pykotaJobId",  
     1057                                               "pykotaPrinterPageCounter",  
     1058                                               "pykotaAction",  
     1059                                               "pykotaJobSize",  
     1060                                               "pykotaJobPrice",  
     1061                                               "pykotaFileName",  
     1062                                               "pykotaTitle",  
     1063                                               "pykotaCopies",  
     1064                                               "pykotaOptions",  
     1065                                               "pykotaBillingCode",  
     1066                                               "pykotaPages",  
     1067                                               "pykotaMD5Sum",  
     1068                                               "createTimestamp" ],  
     1069                                      base=self.info["jobbase"]) 
    10361070        if result : 
    10371071            for (ident, fields) in result : 
     
    10551089                job.JobHostName = fields.get("pykotaHostName", [""])[0] 
    10561090                job.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0] 
     1091                job.JobBillingCode = fields.get("pykotaBillingCode", [None])[0] 
     1092                job.JobMD5Sum = fields.get("pykotaMD5Sum", [None])[0] 
     1093                job.JobPages = fields.get("pykotaPages", [""])[0] 
    10571094                date = fields.get("createTimestamp", ["19700101000000"])[0] 
    10581095                year = int(date[:4]) 
     
    12891326        entries = self.retrieveHistory(user, printer, limit=None) 
    12901327        if entries : 
    1291             result = [ ("username", "printername", "dn", "jobid", "pagecounter", "jobsize", "action", "jobdate", "filename", "title", "copies", "options", "jobprice", "hostname", "jobsizebytes") ]  
     1328            result = [ ("username", "printername", "dn", "jobid", "pagecounter", "jobsize", "action", "jobdate", "filename", "title", "copies", "options", "jobprice", "hostname", "jobsizebytes", "md5sum", "pages", "billingcode") ]  
    12921329            for entry in entries : 
    1293                 result.append((entry.UserName, entry.PrinterName, entry.ident, entry.JobId, entry.PrinterPageCounter, entry.JobSize, entry.JobAction, entry.JobDate, entry.JobFileName, entry.JobTitle, entry.JobCopies, entry.JobOptions, entry.JobPrice, entry.JobHostName, entry.JobSizeBytes))  
     1330                result.append((entry.UserName, entry.PrinterName, entry.ident, entry.JobId, entry.PrinterPageCounter, entry.JobSize, entry.JobAction, entry.JobDate, entry.JobFileName, entry.JobTitle, entry.JobCopies, entry.JobOptions, entry.JobPrice, entry.JobHostName, entry.JobSizeBytes, entry.JobMD5Sum, entry.JobPages, entry.JobBillingCode))  
    12941331            return result