Changeset 1502 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 05/26/04 16:50:12 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1451 r1502 22 22 # 23 23 # $Log$ 24 # Revision 1.64 2004/05/26 14:50:01 jalet 25 # First try at saving the job-originating-hostname in the database 26 # 24 27 # Revision 1.63 2004/05/06 12:37:46 jalet 25 28 # pkpgcounter : comments … … 591 594 lastjob.lastjobident = result[0][0] 592 595 lastjobident = result[0][1]["pykotaLastJobIdent"][0] 593 result = self.doSearch("objectClass=pykotaJob", ["pykota UserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE)596 result = self.doSearch("objectClass=pykotaJob", ["pykotaHostName", "pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE) 594 597 if result : 595 598 fields = result[0][1] … … 605 608 lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 606 609 lastjob.JobOptions = fields.get("pykotaOptions", [""])[0] 610 lastjob.JobHostName = fields.get("pykotaHostName", [""])[0] 607 611 date = fields.get("createTimestamp", ["19700101000000"])[0] 608 612 year = int(date[:4]) … … 912 916 self.doModify(lastjob.ident, fields) 913 917 914 def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None ) :918 def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None, clienthost=None) : 915 919 """Adds a job in a printer's history.""" 916 920 if (not self.disablehistory) or (not printer.LastJob.Exists) : … … 932 936 "pykotaCopies" : str(copies), 933 937 "pykotaOptions" : str(options), 938 "pykotaHostName" : str(clienthost), 934 939 } 935 940 if (not self.disablehistory) or (not printer.LastJob.Exists) : … … 997 1002 self.doModify(pgroup.ident, fields) 998 1003 999 def retrieveHistory(self, user=None, printer=None, datelimit=None, limit=100) :1004 def retrieveHistory(self, user=None, printer=None, datelimit=None, hostname=None, limit=100) : 1000 1005 """Retrieves all print jobs for user on printer (or all) before date, limited to first 100 results.""" 1001 1006 precond = "(objectClass=pykotaJob)" … … 1005 1010 if (printer is not None) and printer.Exists : 1006 1011 where.append("(pykotaPrinterName=%s)" % printer.Name) 1012 if hostname is not None : 1013 where.append("(pykotaHostName=%s)" % hostname) 1007 1014 if where : 1008 1015 where = "(&%s)" % "".join([precond] + where) … … 1010 1017 where = precond 1011 1018 jobs = [] 1012 result = self.doSearch(where, fields=["pykota UserName", "pykotaPrinterName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaAction", "pykotaJobSize", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base=self.info["jobbase"])1019 result = self.doSearch(where, fields=["pykotaHostName", "pykotaUserName", "pykotaPrinterName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaAction", "pykotaJobSize", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base=self.info["jobbase"]) 1013 1020 if result : 1014 1021 for (ident, fields) in result : … … 1024 1031 job.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 1025 1032 job.JobOptions = fields.get("pykotaOptions", [""])[0] 1033 job.JobHostName = fields.get("pykotaHostName", [""])[0] 1026 1034 date = fields.get("createTimestamp", ["19700101000000"])[0] 1027 1035 year = int(date[:4])