Changeset 1203 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 11/23/03 20:01:37 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1200 r1203 22 22 # 23 23 # $Log$ 24 # Revision 1.37 2003/11/23 19:01:37 jalet 25 # Job price added to history 26 # 24 27 # Revision 1.36 2003/11/21 14:28:46 jalet 25 28 # More complete job history. … … 407 410 lastjob.lastjobident = result[0][0] 408 411 lastjobident = result[0][1]["pykotaLastJobIdent"][0] 409 result = self.doSearch("objectClass=pykotaJob", ["pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", " createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE)412 result = self.doSearch("objectClass=pykotaJob", ["pykotaUserName", "pykotaJobId", "pykotaPrinterPageCounter", "pykotaJobSize", "pykotaAction", "pykotaJobPrice", "pykotaFileName", "pykotaTitle", "pykotaCopies", "pykotaOptions", "createTimestamp"], base="cn=%s,%s" % (lastjobident, self.info["jobbase"]), scope=ldap.SCOPE_BASE) 410 413 if result : 411 414 fields = result[0][1] … … 415 418 lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter")[0] or 0) 416 419 lastjob.JobSize = int(fields.get("pykotaJobSize", [0])[0]) 420 lastjob.JobPrice = float(fields.get("pykotaJobPrice", [0.0])[0]) 417 421 lastjob.JobAction = fields.get("pykotaAction")[0] 422 lastjob.JobFileName = fields.get("pykotaFileName")[0] 423 lastjob.JobTitle = fields.get("pykotaTitle")[0] 424 lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 425 lastjob.JobOptions = fields.get("pykotaOptions")[0] 418 426 date = fields.get("createTimestamp")[0] 419 427 year = int(date[:4]) … … 686 694 return self.doModify(user.idbalance, fields) 687 695 688 def writeLastJobSize(self, lastjob, jobsize ) :696 def writeLastJobSize(self, lastjob, jobsize, jobprice) : 689 697 """Sets the last job's size permanently.""" 690 698 fields = { 691 699 "pykotaJobSize" : str(jobsize), 700 "pykotaJobPrice" : str(jobprice), 692 701 } 693 702 self.doModify(lastjob.ident, fields) 694 703 695 def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, filename=None, title=None, copies=None, options=None) :704 def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None) : 696 705 """Adds a job in a printer's history.""" 697 706 if (not self.disablehistory) or (not printer.LastJob.Exists) : … … 716 725 if (not self.disablehistory) or (not printer.LastJob.Exists) : 717 726 if jobsize is not None : 718 fields.update({ "pykotaJobSize" : str(jobsize) })727 fields.update({ "pykotaJobSize" : str(jobsize), "pykotaJobPrice" : str(jobprice) }) 719 728 self.doAdd(dn, fields) 720 729 else : 721 730 # here we explicitly want to reset jobsize to 'None' if needed 722 fields.update({ "pykotaJobSize" : str(jobsize) })731 fields.update({ "pykotaJobSize" : str(jobsize), "pykotaJobPrice" : str(jobprice) }) 723 732 self.doModify(dn, fields) 724 733