Changeset 1990 for pykota/trunk/pykota
- Timestamp:
- 12/21/04 15:45:31 (19 years ago)
- Location:
- pykota/trunk/pykota/storages
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1969 r1990 22 22 # 23 23 # $Log$ 24 # Revision 1.90 2004/12/21 14:45:31 jalet 25 # Prepared dumpykota to accept the new --filter command line option. Some 26 # additionnal work needs to be done in the backends though. 27 # 24 28 # Revision 1.89 2004/12/02 22:27:11 jalet 25 29 # Integrated and extended Stefan Wold's patch to store print quota entries … … 1396 1400 self.doDelete(printer.ident) 1397 1401 1398 def extractPrinters(self ) :1402 def extractPrinters(self, extractonly={}) : 1399 1403 """Extracts all printer records.""" 1400 1404 entries = [p for p in [self.getPrinter(name) for name in self.getAllPrintersNames()] if p.Exists] … … 1405 1409 return result 1406 1410 1407 def extractUsers(self ) :1411 def extractUsers(self, extractonly={}) : 1408 1412 """Extracts all user records.""" 1409 1413 entries = [u for u in [self.getUser(name) for name in self.getAllUsersNames()] if u.Exists] … … 1414 1418 return result 1415 1419 1416 def extractGroups(self ) :1420 def extractGroups(self, extractonly={}) : 1417 1421 """Extracts all group records.""" 1418 1422 entries = [g for g in [self.getGroup(name) for name in self.getAllGroupsNames()] if g.Exists] … … 1423 1427 return result 1424 1428 1425 def extractPayments(self ) :1429 def extractPayments(self, extractonly={}) : 1426 1430 """Extracts all payment records.""" 1427 1431 entries = [u for u in [self.getUser(name) for name in self.getAllUsersNames()] if u.Exists] … … 1433 1437 return result 1434 1438 1435 def extractUpquotas(self ) :1439 def extractUpquotas(self, extractonly={}) : 1436 1440 """Extracts all userpquota records.""" 1437 1441 entries = [p for p in [self.getPrinter(name) for name in self.getAllPrintersNames()] if p.Exists] … … 1443 1447 return result 1444 1448 1445 def extractGpquotas(self ) :1449 def extractGpquotas(self, extractonly={}) : 1446 1450 """Extracts all grouppquota records.""" 1447 1451 entries = [p for p in [self.getPrinter(name) for name in self.getAllPrintersNames()] if p.Exists] … … 1453 1457 return result 1454 1458 1455 def extractUmembers(self ) :1459 def extractUmembers(self, extractonly={}) : 1456 1460 """Extracts all user groups members.""" 1457 1461 entries = [g for g in [self.getGroup(name) for name in self.getAllGroupsNames()] if g.Exists] … … 1463 1467 return result 1464 1468 1465 def extractPmembers(self ) :1469 def extractPmembers(self, extractonly={}) : 1466 1470 """Extracts all printer groups members.""" 1467 1471 entries = [p for p in [self.getPrinter(name) for name in self.getAllPrintersNames()] if p.Exists] … … 1473 1477 return result 1474 1478 1475 def extractHistory(self ) :1479 def extractHistory(self, extractonly={}) : 1476 1480 """Extracts all jobhistory records.""" 1477 1481 entries = self.retrieveHistory(limit=None) -
pykota/trunk/pykota/storages/sql.py
r1875 r1990 22 22 # 23 23 # $Log$ 24 # Revision 1.60 2004/12/21 14:45:31 jalet 25 # Prepared dumpykota to accept the new --filter command line option. Some 26 # additionnal work needs to be done in the backends though. 27 # 24 28 # Revision 1.59 2004/10/25 14:12:25 jalet 25 29 # For URGENT legal reasons (Italy), a new "privacy" directive was added to pykota.conf … … 132 136 return entries 133 137 134 def extractPrinters(self ) :138 def extractPrinters(self, extractonly={}) : 135 139 """Extracts all printer records.""" 136 140 result = self.doRawSearch("SELECT * FROM printers ORDER BY id ASC") 137 141 return self.prepareRawResult(result) 138 142 139 def extractUsers(self ) :143 def extractUsers(self, extractonly={}) : 140 144 """Extracts all user records.""" 141 145 result = self.doRawSearch("SELECT * FROM users ORDER BY id ASC") 142 146 return self.prepareRawResult(result) 143 147 144 def extractGroups(self ) :148 def extractGroups(self, extractonly={}) : 145 149 """Extracts all group records.""" 146 150 result = self.doRawSearch("SELECT groups.*,COALESCE(SUM(balance), 0) AS balance, COALESCE(SUM(lifetimepaid), 0) as lifetimepaid FROM groups LEFT OUTER JOIN users ON users.id IN (SELECT userid FROM groupsmembers WHERE groupid=groups.id) GROUP BY groups.id,groups.groupname,groups.limitby ORDER BY groups.id ASC") 147 151 return self.prepareRawResult(result) 148 152 149 def extractPayments(self ) :153 def extractPayments(self, extractonly={}) : 150 154 """Extracts all payment records.""" 151 155 result = self.doRawSearch("SELECT username,payments.* FROM users,payments WHERE users.id=payments.userid ORDER BY payments.id ASC") 152 156 return self.prepareRawResult(result) 153 157 154 def extractUpquotas(self ) :158 def extractUpquotas(self, extractonly={}) : 155 159 """Extracts all userpquota records.""" 156 160 result = self.doRawSearch("SELECT users.username,printers.printername,userpquota.* FROM users,printers,userpquota WHERE users.id=userpquota.userid AND printers.id=userpquota.printerid ORDER BY userpquota.id ASC") 157 161 return self.prepareRawResult(result) 158 162 159 def extractGpquotas(self ) :163 def extractGpquotas(self, extractonly={}) : 160 164 """Extracts all grouppquota records.""" 161 165 result = self.doRawSearch("SELECT groups.groupname,printers.printername,grouppquota.*,coalesce(sum(pagecounter), 0) AS pagecounter,coalesce(sum(lifepagecounter), 0) AS lifepagecounter FROM groups,printers,grouppquota,userpquota WHERE groups.id=grouppquota.groupid AND printers.id=grouppquota.printerid AND userpquota.printerid=grouppquota.printerid AND userpquota.userid IN (SELECT userid FROM groupsmembers WHERE groupsmembers.groupid=grouppquota.groupid) GROUP BY grouppquota.id,grouppquota.groupid,grouppquota.printerid,grouppquota.softlimit,grouppquota.hardlimit,grouppquota.datelimit,groups.groupname,printers.printername ORDER BY grouppquota.id") 162 166 return self.prepareRawResult(result) 163 167 164 def extractUmembers(self ) :168 def extractUmembers(self, extractonly={}) : 165 169 """Extracts all user groups members.""" 166 170 result = self.doRawSearch("SELECT groups.groupname, users.username, groupsmembers.* FROM groups,users,groupsmembers WHERE users.id=groupsmembers.userid AND groups.id=groupsmembers.groupid ORDER BY groupsmembers.groupid, groupsmembers.userid ASC") 167 171 return self.prepareRawResult(result) 168 172 169 def extractPmembers(self ) :173 def extractPmembers(self, extractonly={}) : 170 174 """Extracts all printer groups members.""" 171 175 result = self.doRawSearch("SELECT p1.printername as pgroupname, p2.printername as printername, printergroupsmembers.* FROM printers p1, printers p2, printergroupsmembers WHERE p1.id=printergroupsmembers.groupid AND p2.id=printergroupsmembers.printerid ORDER BY printergroupsmembers.groupid, printergroupsmembers.printerid ASC") 172 176 return self.prepareRawResult(result) 173 177 174 def extractHistory(self ) :178 def extractHistory(self, extractonly={}) : 175 179 """Extracts all jobhistory records.""" 176 180 result = self.doRawSearch("SELECT users.username,printers.printername,jobhistory.* FROM users,printers,jobhistory WHERE users.id=jobhistory.userid AND printers.id=jobhistory.printerid ORDER BY jobhistory.id ASC")