Changeset 2030 for pykota/trunk
- Timestamp:
- 01/18/05 20:47:50 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r2028 r2030 24 24 # 25 25 # $Log$ 26 # Revision 1.85 2005/01/18 19:47:49 jalet 27 # Big bug fix wrt the datelimit attribute 28 # 26 29 # Revision 1.84 2005/01/17 08:44:23 jalet 27 30 # Modified copyright years … … 691 694 changed[entry.Name]["limitby"] = limitby 692 695 696 if options["reset"] : 697 entrypquota.reset() 698 699 if options["hardreset"] : 700 entrypquota.hardreset() 701 693 702 if not options["groups"] : 694 if options["reset"] :695 entrypquota.reset()696 if options["hardreset"] :697 entrypquota.hardreset()698 703 if options["used"] : 699 704 entrypquota.setUsage(used) … … 773 778 elif options["noquota"] and (options["prototype"] or options["hardlimit"] or options["softlimit"]) : 774 779 raise PyKotaToolError, _("incompatible options, see help.") 775 elif options["groups"] and (options["balance"] or options["ingroups"] or options["used"] or options["reset"] or options["hardreset"]) :780 elif options["groups"] and (options["balance"] or options["ingroups"] or options["used"]) : 776 781 raise PyKotaToolError, _("incompatible options, see help.") 777 782 else : -
pykota/trunk/NEWS
r2028 r2030 22 22 PyKota NEWS : 23 23 24 - 1.21alpha20 : 25 26 - Big bug fix wrt the datelimit field which was never 27 reset. 28 24 29 - 1.21alpha19 : 25 30 -
pykota/trunk/pykota/storage.py
r1967 r2030 22 22 # 23 23 # $Log$ 24 # Revision 1.67 2005/01/18 19:47:50 jalet 25 # Big bug fix wrt the datelimit attribute 26 # 24 27 # Revision 1.66 2004/12/02 21:24:50 jalet 25 28 # Integrated the patch by Wilson Roberto Afonso and Matt Hyclak to allow … … 447 450 vused = int(used) 448 451 if used.startswith("+") or used.startswith("-") : 449 self.parent.increaseUserPQuotaPagesCounters(self, vused) 450 self.PageCounter += vused 451 self.LifePageCounter += vused 452 self.parent.beginTransaction() 453 try : 454 self.parent.increaseUserPQuotaPagesCounters(self, vused) 455 self.parent.writeUserPQuotaDateLimit(self, None) 456 except PyKotaStorageError, msg : 457 self.parent.rollbackTransaction() 458 raise PyKotaStorageError, msg 459 else : 460 self.parent.commitTransaction() 461 self.PageCounter += vused 462 self.LifePageCounter += vused 452 463 else : 453 self.parent.writeUserPQuotaPagesCounters(self, vused, vused) 454 self.PageCounter = self.LifePageCounter = vused 464 self.parent.writeUserPQuotaPagesCounters(self, vused, vused) 465 self.PageCounter = self.LifePageCounter = vused 466 self.DateLimit = None 455 467 456 468 def reset(self) : … … 458 470 self.parent.writeUserPQuotaPagesCounters(self, 0, int(self.LifePageCounter or 0)) 459 471 self.PageCounter = 0 472 self.DateLimit = None 460 473 461 474 def hardreset(self) : … … 463 476 self.parent.writeUserPQuotaPagesCounters(self, 0, 0) 464 477 self.PageCounter = self.LifePageCounter = 0 478 self.DateLimit = None 465 479 466 480 def computeJobPrice(self, jobsize) : … … 512 526 raise AttributeError, name 513 527 528 def reset(self) : 529 """Resets page counter to 0.""" 530 self.parent.beginTransaction() 531 try : 532 for user in self.parent.getGroupMembers(self.Group) : 533 uq = self.parent.getUserPQuota(user, self.Printer) 534 uq.reset() 535 self.parent.writeGroupPQuotaDateLimit(self, None) 536 except PyKotaStorageError, msg : 537 self.parent.rollbackTransaction() 538 raise PyKotaStorageError, msg 539 else : 540 self.parent.commitTransaction() 541 self.PageCounter = 0 542 self.DateLimit = None 543 544 def hardreset(self) : 545 """Resets actual and life time page counters to 0.""" 546 self.parent.beginTransaction() 547 try : 548 for user in self.parent.getGroupMembers(self.Group) : 549 uq = self.parent.getUserPQuota(user, self.Printer) 550 uq.hardreset() 551 self.parent.writeGroupPQuotaDateLimit(self, None) 552 except PyKotaStorageError, msg : 553 self.parent.rollbackTransaction() 554 raise PyKotaStorageError, msg 555 else : 556 self.parent.commitTransaction() 557 self.PageCounter = self.LifePageCounter = 0 558 self.DateLimit = None 559 514 560 def setDateLimit(self, datelimit) : 515 561 """Sets the date limit for this quota.""" -
pykota/trunk/pykota/storages/ldapstorage.py
r2000 r2030 22 22 # 23 23 # $Log$ 24 # Revision 1.95 2005/01/18 19:47:50 jalet 25 # Big bug fix wrt the datelimit attribute 26 # 24 27 # Revision 1.94 2005/01/01 18:53:27 jalet 25 28 # Implemented in the LDAP backend code the same fix than in PostgreSQL backend … … 1167 1170 "pykotaPageCounter" : str(newpagecounter), 1168 1171 "pykotaLifePageCounter" : str(newlifepagecounter), 1172 "pykotaDateLimit" : None, 1169 1173 } 1170 1174 return self.doModify(userpquota.ident, fields) -
pykota/trunk/pykota/storages/sql.py
r1999 r2030 22 22 # 23 23 # $Log$ 24 # Revision 1.64 2005/01/18 19:47:50 jalet 25 # Big bug fix wrt the datelimit attribute 26 # 24 27 # Revision 1.63 2005/01/01 08:16:17 jalet 25 28 # Fixed a problem which occured when 'limitby' was unset in the PostgreSQL … … 522 525 def writeUserPQuotaPagesCounters(self, userpquota, newpagecounter, newlifepagecounter) : 523 526 """Sets the new page counters permanently for a user print quota.""" 524 self.doModify("UPDATE userpquota SET pagecounter=%s, lifepagecounter=%sWHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident)))527 self.doModify("UPDATE userpquota SET pagecounter=%s, lifepagecounter=%s, datelimit=NULL WHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident))) 525 528 526 529 def decreaseUserAccountBalance(self, user, amount) : -
pykota/trunk/pykota/version.py
r2020 r2030 22 22 # 23 23 24 __version__ = "1.21alpha 19_unofficial"24 __version__ = "1.21alpha20_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""