Changeset 1330 for pykota/trunk/pykota

Show
Ignore:
Timestamp:
02/04/04 12:17:00 (20 years ago)
Author:
jalet
Message:

pkprinters command line tool added.

Location:
pykota/trunk/pykota
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storage.py

    r1285 r1330  
    2222# 
    2323# $Log$ 
     24# Revision 1.39  2004/02/04 11:16:59  jalet 
     25# pkprinters command line tool added. 
     26# 
    2427# Revision 1.38  2004/01/12 22:43:40  jalet 
    2528# New formula to compute a job's price 
     
    272275            self.PricePerJob = float(priceperjob) 
    273276        self.parent.writePrinterPrices(self) 
     277         
     278    def delete(self) :     
     279        """Deletes a printer from the Quota Storage.""" 
     280        self.parent.beginTransaction() 
     281        try : 
     282            self.parent.deletePrinter(self) 
     283        except PyKotaStorageError, msg :     
     284            self.parent.rollbackTransaction() 
     285            raise PyKotaStorageError, msg 
     286        else :     
     287            self.parent.commitTransaction() 
    274288         
    275289class StorageUserPQuota(StorageObject) : 
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1320 r1330  
    2222# 
    2323# $Log$ 
     24# Revision 1.50  2004/02/04 11:17:00  jalet 
     25# pkprinters command line tool added. 
     26# 
    2427# Revision 1.49  2004/01/29 22:35:45  jalet 
    2528# Small fix from Matt. 
     
    974977            else :     
    975978                self.doDelete(group.ident) 
    976              
     979                 
     980    def deletePrinter(self, printer) :     
     981        """Completely deletes an user from the Quota Storage.""" 
     982        result = self.doSearch("(&(objectClass=pykotaLastJob)(pykotaPrinterName=%s))" % printer.Name, base=self.info["lastjobbase"]) 
     983        for (ident, fields) in result : 
     984            self.doDelete(ident) 
     985        result = self.doSearch("(&(objectClass=pykotaJob)(pykotaPrinterName=%s))" % printer.Name, base=self.info["jobbase"]) 
     986        for (ident, fields) in result : 
     987            self.doDelete(ident) 
     988        result = self.doSearch("(&(objectClass=pykotaGroupPQuota)(pykotaPrinterName=%s))" % printer.Name, base=self.info["groupquotabase"]) 
     989        for (ident, fields) in result : 
     990            self.doDelete(ident) 
     991        result = self.doSearch("(&(objectClass=pykotaUserPQuota)(pykotaPrinterName=%s))" % printer.Name, base=self.info["userquotabase"]) 
     992        for (ident, fields) in result : 
     993            self.doDelete(ident) 
     994        for parent in self.getParentPrinters(printer) :   
     995            parent.uniqueMember.remove(printer.ident) 
     996            fields = { 
     997                       "uniqueMember" : parent.uniqueMember, 
     998                     }   
     999            self.doModify(parent.ident, fields)          
     1000        self.doDelete(printer.ident)     
  • pykota/trunk/pykota/storages/sql.py

    r1327 r1330  
    2222# 
    2323# $Log$ 
     24# Revision 1.35  2004/02/04 11:17:00  jalet 
     25# pkprinters command line tool added. 
     26# 
    2427# Revision 1.34  2004/02/02 22:44:16  jalet 
    2528# Preliminary work on Relationnal Database Independance via DB-API 2.0 
     
    408411                 ] :   
    409412            self.doModify(q) 
    410          
     413             
     414    def deletePrinter(self, printer) :     
     415        """Completely deletes a printer from the Quota Storage.""" 
     416        for q in [  
     417                    "DELETE FROM printergroupsmembers WHERE groupid=%s OR printerid=%s" % (self.doQuote(printer.ident), self.doQuote(printer.ident)), 
     418                    "DELETE FROM jobhistory WHERE printerid=%s" % self.doQuote(printer.ident), 
     419                    "DELETE FROM grouppquota WHERE printerid=%s" % self.doQuote(printer.ident), 
     420                    "DELETE FROM userpquota WHERE printerid=%s" % self.doQuote(printer.ident), 
     421                    "DELETE FROM printers WHERE id=%s" % self.doQuote(printer.ident), 
     422                  ] : 
     423            self.doModify(q) 
     424         
  • pykota/trunk/pykota/version.py

    r1325 r1330  
    2222# 
    2323 
    24 __version__ = "1.18alpha1_unofficial" 
     24__version__ = "1.18alpha2_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""