Changeset 2717 for pykota/trunk/pykota/storage.py
- Timestamp:
- 02/20/06 22:12:24 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storage.py
r2707 r2717 26 26 27 27 class PyKotaStorageError(Exception): 28 """An exception for Quota Storage related stuff."""28 """An exception for database related stuff.""" 29 29 def __init__(self, message = ""): 30 30 self.message = message … … 35 35 36 36 class StorageObject : 37 """Object present in the Quota Storage."""37 """Object present in the database.""" 38 38 def __init__(self, parent) : 39 39 "Initialize minimal data.""" … … 98 98 99 99 def delete(self) : 100 """Deletes an user from the Quota Storage."""100 """Deletes an user from the database.""" 101 101 self.parent.beginTransaction() 102 102 try : … … 142 142 143 143 def delete(self) : 144 """Deletes a group from the Quota Storage."""144 """Deletes a group from the database.""" 145 145 self.parent.beginTransaction() 146 146 try : … … 216 216 217 217 def delete(self) : 218 """Deletes a printer from the Quota Storage."""218 """Deletes a printer from the database.""" 219 219 self.parent.beginTransaction() 220 220 try : … … 343 343 return jobprice 344 344 345 def delete(self) : 346 """Deletes an user print quota entry from the database.""" 347 self.parent.beginTransaction() 348 try : 349 self.parent.deleteUserPQuota(self) 350 except PyKotaStorageError, msg : 351 self.parent.rollbackTransaction() 352 raise PyKotaStorageError, msg 353 else : 354 self.parent.commitTransaction() 355 if self.parent.usecache : 356 for (k, v) in self.parent.caches["USERPQUOTAS"].items() : 357 if v.User.Name == self.User.Name : 358 self.parent.flushEntry("USERPQUOTAS", "%s@%s" % (v.User.Name, v.Printer.Name)) 359 self.Exists = 0 360 345 361 class StorageGroupPQuota(StorageObject) : 346 362 """Group Print Quota class.""" … … 413 429 self.HardLimit = hardlimit 414 430 self.DateLimit = None 431 432 def delete(self) : 433 """Deletes a group print quota entry from the database.""" 434 self.parent.beginTransaction() 435 try : 436 self.parent.deleteGroupPQuota(self) 437 except PyKotaStorageError, msg : 438 self.parent.rollbackTransaction() 439 raise PyKotaStorageError, msg 440 else : 441 self.parent.commitTransaction() 442 if self.parent.usecache : 443 for (k, v) in self.parent.caches["GROUPPQUOTAS"].items() : 444 if v.Group.Name == self.Group.Name : 445 self.parent.flushEntry("GROUPPQUOTAS", "%s@%s" % (v.Group.Name, v.Printer.Name)) 446 self.Exists = 0 415 447 416 448 class StorageJob(StorageObject) : … … 773 805 774 806 def openConnection(pykotatool) : 775 """Returns a connection handle to the appropriate Quota Storage Database."""807 """Returns a connection handle to the appropriate database.""" 776 808 backendinfo = pykotatool.config.getStorageBackend() 777 809 backend = backendinfo["storagebackend"]