root / pykota / trunk / pykota / storages / pgstorage.py @ 1200

Revision 1200, 24.6 kB (checked in by jalet, 20 years ago)

More complete job history.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# PyKota
2# -*- coding: ISO-8859-15 -*-
3#
4# PyKota : Print Quotas for CUPS and LPRng
5#
6# (c) 2003 Jerome Alet <alet@librelogiciel.com>
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
20#
21# $Id$
22#
23# $Log$
24# Revision 1.22  2003/11/21 14:28:46  jalet
25# More complete job history.
26#
27# Revision 1.21  2003/11/12 13:06:38  jalet
28# Bug fix wrt no user/group name command line argument to edpykota
29#
30# Revision 1.20  2003/10/09 21:25:26  jalet
31# Multiple printer names or wildcards can be passed on the command line
32# separated with commas.
33# Beta phase.
34#
35# Revision 1.19  2003/10/08 07:01:20  jalet
36# Job history can be disabled.
37# Some typos in README.
38# More messages in setup script.
39#
40# Revision 1.18  2003/10/07 09:07:30  jalet
41# Character encoding added to please latest version of Python
42#
43# Revision 1.17  2003/10/06 13:12:28  jalet
44# More work on caching
45#
46# Revision 1.16  2003/10/03 18:01:49  jalet
47# Nothing interesting...
48#
49# Revision 1.15  2003/10/03 12:27:03  jalet
50# Several optimizations, especially with LDAP backend
51#
52# Revision 1.14  2003/10/03 08:57:55  jalet
53# Caching mechanism now caches all that's cacheable.
54#
55# Revision 1.13  2003/10/02 20:23:18  jalet
56# Storage caching mechanism added.
57#
58# Revision 1.12  2003/08/17 14:20:25  jalet
59# Bug fix by Oleg Biteryakov
60#
61# Revision 1.11  2003/07/29 20:55:17  jalet
62# 1.14 is out !
63#
64# Revision 1.10  2003/07/16 21:53:08  jalet
65# Really big modifications wrt new configuration file's location and content.
66#
67# Revision 1.9  2003/07/14 17:20:15  jalet
68# Bug in postgresql storage when modifying the prices for a printer
69#
70# Revision 1.8  2003/07/14 14:18:17  jalet
71# Wrong documentation strings
72#
73# Revision 1.7  2003/07/09 20:17:07  jalet
74# Email field added to PostgreSQL schema
75#
76# Revision 1.6  2003/07/07 11:49:24  jalet
77# Lots of small fixes with the help of PyChecker
78#
79# Revision 1.5  2003/07/07 08:33:19  jalet
80# Bug fix due to a typo in LDAP code
81#
82# Revision 1.4  2003/06/30 13:54:21  jalet
83# Sorts by user / group name
84#
85# Revision 1.3  2003/06/25 14:10:01  jalet
86# Hey, it may work (edpykota --reset excepted) !
87#
88# Revision 1.2  2003/06/12 21:09:57  jalet
89# wrongly placed code.
90#
91# Revision 1.1  2003/06/10 16:37:54  jalet
92# Deletion of the second user which is not needed anymore.
93# Added a debug configuration field in /etc/pykota.conf
94# All queries can now be sent to the logger in debug mode, this will
95# greatly help improve performance when time for this will come.
96#
97#
98#
99#
100
101from pykota.storage import PyKotaStorageError,BaseStorage,StorageObject,StorageUser,StorageGroup,StoragePrinter,StorageLastJob,StorageUserPQuota,StorageGroupPQuota
102
103try :
104    import pg
105except ImportError :   
106    import sys
107    # TODO : to translate or not to translate ?
108    raise PyKotaStorageError, "This python version (%s) doesn't seem to have the PygreSQL module installed correctly." % sys.version.split()[0]
109
110class Storage(BaseStorage) :
111    def __init__(self, pykotatool, host, dbname, user, passwd) :
112        """Opens the PostgreSQL database connection."""
113        BaseStorage.__init__(self, pykotatool)
114        try :
115            (host, port) = host.split(":")
116            port = int(port)
117        except ValueError :   
118            port = -1         # Use PostgreSQL's default tcp/ip port (5432).
119       
120        try :
121            self.database = pg.connect(host=host, port=port, dbname=dbname, user=user, passwd=passwd)
122        except pg.error, msg :
123            raise PyKotaStorageError, msg
124        else :   
125            self.closed = 0
126            self.tool.logdebug("Database opened (host=%s, port=%s, dbname=%s, user=%s)" % (host, port, dbname, user))
127           
128    def close(self) :   
129        """Closes the database connection."""
130        if not self.closed :
131            self.database.close()
132            self.closed = 1
133            self.tool.logdebug("Database closed.")
134       
135    def beginTransaction(self) :   
136        """Starts a transaction."""
137        self.database.query("BEGIN;")
138        self.tool.logdebug("Transaction begins...")
139       
140    def commitTransaction(self) :   
141        """Commits a transaction."""
142        self.database.query("COMMIT;")
143        self.tool.logdebug("Transaction committed.")
144       
145    def rollbackTransaction(self) :     
146        """Rollbacks a transaction."""
147        self.database.query("ROLLBACK;")
148        self.tool.logdebug("Transaction aborted.")
149       
150    def doSearch(self, query) :
151        """Does a search query."""
152        query = query.strip()   
153        if not query.endswith(';') :   
154            query += ';'
155        try :
156            self.tool.logdebug("QUERY : %s" % query)
157            result = self.database.query(query)
158        except pg.error, msg :   
159            raise PyKotaStorageError, msg
160        else :   
161            if (result is not None) and (result.ntuples() > 0) : 
162                return result.dictresult()
163           
164    def doModify(self, query) :
165        """Does a (possibly multiple) modify query."""
166        query = query.strip()   
167        if not query.endswith(';') :   
168            query += ';'
169        try :
170            self.tool.logdebug("QUERY : %s" % query)
171            result = self.database.query(query)
172        except pg.error, msg :   
173            raise PyKotaStorageError, msg
174        else :   
175            return result
176           
177    def doQuote(self, field) :
178        """Quotes a field for use as a string in SQL queries."""
179        if type(field) == type(0.0) : 
180            typ = "decimal"
181        elif type(field) == type(0) :   
182            typ = "int"
183        else :   
184            typ = "text"
185        return pg._quote(field, typ)
186       
187    def getAllUsersNames(self) :   
188        """Extracts all user names."""
189        usernames = []
190        result = self.doSearch("SELECT username FROM users;")
191        if result :
192            usernames = [record["username"] for record in result]
193        return usernames
194       
195    def getAllGroupsNames(self) :   
196        """Extracts all group names."""
197        groupnames = []
198        result = self.doSearch("SELECT groupname FROM groups;")
199        if result :
200            groupnames = [record["groupname"] for record in result]
201        return groupnames
202       
203    def getUserFromBackend(self, username) :   
204        """Extracts user information given its name."""
205        user = StorageUser(self, username)
206        result = self.doSearch("SELECT * FROM users WHERE username=%s LIMIT 1" % self.doQuote(username))
207        if result :
208            fields = result[0]
209            user.ident = fields.get("id")
210            user.LimitBy = fields.get("limitby")
211            user.AccountBalance = fields.get("balance")
212            user.LifeTimePaid = fields.get("lifetimepaid")
213            user.Email = fields.get("email")
214            user.Exists = 1
215        return user
216       
217    def getGroupFromBackend(self, groupname) :   
218        """Extracts group information given its name."""
219        group = StorageGroup(self, groupname)
220        result = self.doSearch("SELECT * FROM groups WHERE groupname=%s LIMIT 1" % self.doQuote(groupname))
221        if result :
222            fields = result[0]
223            group.ident = fields.get("id")
224            group.LimitBy = fields.get("limitby")
225            result = self.doSearch("SELECT SUM(balance) AS balance, SUM(lifetimepaid) AS lifetimepaid FROM users WHERE id IN (SELECT userid FROM groupsmembers WHERE groupid=%s)" % self.doQuote(group.ident))
226            if result :
227                fields = result[0]
228                group.AccountBalance = fields.get("balance")
229                group.LifeTimePaid = fields.get("lifetimepaid")
230            group.Exists = 1
231        return group
232       
233    def getPrinterFromBackend(self, printername) :       
234        """Extracts printer information given its name."""
235        printer = StoragePrinter(self, printername)
236        result = self.doSearch("SELECT * FROM printers WHERE printername=%s LIMIT 1" % self.doQuote(printername))
237        if result :
238            fields = result[0]
239            printer.ident = fields.get("id")
240            printer.PricePerJob = fields.get("priceperjob")
241            printer.PricePerPage = fields.get("priceperpage")
242            printer.LastJob = self.getPrinterLastJob(printer)
243            printer.Exists = 1
244        return printer   
245       
246    def getUserPQuotaFromBackend(self, user, printer) :       
247        """Extracts a user print quota."""
248        userpquota = StorageUserPQuota(self, user, printer)
249        if user.Exists :
250            result = self.doSearch("SELECT id, lifepagecounter, pagecounter, softlimit, hardlimit, datelimit FROM userpquota WHERE userid=%s AND printerid=%s" % (self.doQuote(user.ident), self.doQuote(printer.ident)))
251            if result :
252                fields = result[0]
253                userpquota.ident = fields.get("id")
254                userpquota.PageCounter = fields.get("pagecounter")
255                userpquota.LifePageCounter = fields.get("lifepagecounter")
256                userpquota.SoftLimit = fields.get("softlimit")
257                userpquota.HardLimit = fields.get("hardlimit")
258                userpquota.DateLimit = fields.get("datelimit")
259                userpquota.Exists = 1
260        return userpquota
261       
262    def getGroupPQuotaFromBackend(self, group, printer) :       
263        """Extracts a group print quota."""
264        grouppquota = StorageGroupPQuota(self, group, printer)
265        if group.Exists :
266            result = self.doSearch("SELECT id, softlimit, hardlimit, datelimit FROM grouppquota WHERE groupid=%s AND printerid=%s" % (self.doQuote(group.ident), self.doQuote(printer.ident)))
267            if result :
268                fields = result[0]
269                grouppquota.ident = fields.get("id")
270                grouppquota.SoftLimit = fields.get("softlimit")
271                grouppquota.HardLimit = fields.get("hardlimit")
272                grouppquota.DateLimit = fields.get("datelimit")
273                result = self.doSearch("SELECT SUM(lifepagecounter) AS lifepagecounter, SUM(pagecounter) AS pagecounter FROM userpquota WHERE printerid=%s AND userid IN (SELECT userid FROM groupsmembers WHERE groupid=%s)" % (self.doQuote(printer.ident), self.doQuote(group.ident)))
274                if result :
275                    fields = result[0]
276                    grouppquota.PageCounter = fields.get("pagecounter")
277                    grouppquota.LifePageCounter = fields.get("lifepagecounter")
278                grouppquota.Exists = 1
279        return grouppquota
280       
281    def getPrinterLastJobFromBackend(self, printer) :       
282        """Extracts a printer's last job information."""
283        lastjob = StorageLastJob(self, printer)
284        result = self.doSearch("SELECT jobhistory.id, jobid, userid, username, pagecounter, jobsize, jobdate FROM jobhistory, users WHERE printerid=%s AND userid=users.id ORDER BY jobdate DESC LIMIT 1" % self.doQuote(printer.ident))
285        if result :
286            fields = result[0]
287            lastjob.ident = fields.get("id")
288            lastjob.JobId = fields.get("jobid")
289            lastjob.User = self.getUser(fields.get("username"))
290            lastjob.PrinterPageCounter = fields.get("pagecounter")
291            lastjob.JobSize = fields.get("jobsize")
292            lastjob.JobAction = fields.get("action")
293            lastjob.JobDate = fields.get("jobdate")
294            lastjob.Exists = 1
295        return lastjob
296           
297    def getGroupMembersFromBackend(self, group) :       
298        """Returns the group's members list."""
299        groupmembers = []
300        result = self.doSearch("SELECT * FROM groupsmembers JOIN users ON groupsmembers.userid=users.id WHERE groupid=%s" % self.doQuote(group.ident))
301        if result :
302            for record in result :
303                user = StorageUser(self, record.get("username"))
304                user.ident = record.get("userid")
305                user.LimitBy = record.get("limitby")
306                user.AccountBalance = record.get("balance")
307                user.LifeTimePaid = record.get("lifetimepaid")
308                user.Email = record.get("email")
309                user.Exists = 1
310                groupmembers.append(user)
311                self.cacheEntry("USERS", user.Name, user)
312        return groupmembers       
313       
314    def getUserGroupsFromBackend(self, user) :       
315        """Returns the user's groups list."""
316        groups = []
317        result = self.doSearch("SELECT groupname FROM groupsmembers JOIN groups ON groupsmembers.groupid=groups.id WHERE userid=%s" % self.doQuote(user.ident))
318        if result :
319            for record in result :
320                groups.append(self.getGroup(record.get("groupname")))
321        return groups       
322       
323    def getMatchingPrinters(self, printerpattern) :
324        """Returns the list of all printers for which name matches a certain pattern."""
325        printers = []
326        # We 'could' do a SELECT printername FROM printers WHERE printername LIKE ...
327        # but we don't because other storages semantics may be different, so every
328        # storage should use fnmatch to match patterns and be storage agnostic
329        result = self.doSearch("SELECT * FROM printers")
330        if result :
331            for record in result :
332                if self.tool.matchString(record["printername"], printerpattern.split(",")) :
333                    printer = StoragePrinter(self, record["printername"])
334                    printer.ident = record.get("id")
335                    printer.PricePerJob = record.get("priceperjob")
336                    printer.PricePerPage = record.get("priceperpage")
337                    printer.LastJob = self.getPrinterLastJob(printer)
338                    printer.Exists = 1
339                    printers.append(printer)
340                    self.cacheEntry("PRINTERS", printer.Name, printer)
341        return printers       
342       
343    def getPrinterUsersAndQuotas(self, printer, names=["*"]) :       
344        """Returns the list of users who uses a given printer, along with their quotas."""
345        usersandquotas = []
346        result = self.doSearch("SELECT users.id as uid,username,balance,lifetimepaid,limitby,email,userpquota.id,lifepagecounter,pagecounter,softlimit,hardlimit,datelimit FROM users JOIN userpquota ON users.id=userpquota.userid AND printerid=%s ORDER BY username ASC" % self.doQuote(printer.ident))
347        if result :
348            for record in result :
349                if self.tool.matchString(record.get("username"), names) :
350                    user = StorageUser(self, record.get("username"))
351                    user.ident = record.get("uid")
352                    user.LimitBy = record.get("limitby")
353                    user.AccountBalance = record.get("balance")
354                    user.LifeTimePaid = record.get("lifetimepaid")
355                    user.Email = record.get("email") 
356                    user.Exists = 1
357                    userpquota = StorageUserPQuota(self, user, printer)
358                    userpquota.ident = record.get("id")
359                    userpquota.PageCounter = record.get("pagecounter")
360                    userpquota.LifePageCounter = record.get("lifepagecounter")
361                    userpquota.SoftLimit = record.get("softlimit")
362                    userpquota.HardLimit = record.get("hardlimit")
363                    userpquota.DateLimit = record.get("datelimit")
364                    userpquota.Exists = 1
365                    usersandquotas.append((user, userpquota))
366                    self.cacheEntry("USERS", user.Name, user)
367                    self.cacheEntry("USERPQUOTAS", "%s@%s" % (user.Name, printer.Name), userpquota)
368        return usersandquotas
369               
370    def getPrinterGroupsAndQuotas(self, printer, names=["*"]) :       
371        """Returns the list of groups which uses a given printer, along with their quotas."""
372        groupsandquotas = []
373        result = self.doSearch("SELECT groupname FROM groups JOIN grouppquota ON groups.id=grouppquota.groupid AND printerid=%s ORDER BY groupname ASC" % self.doQuote(printer.ident))
374        if result :
375            for record in result :
376                if self.tool.matchString(record.get("groupname"), names) :
377                    group = self.getGroup(record.get("groupname"))
378                    grouppquota = self.getGroupPQuota(group, printer)
379                    groupsandquotas.append((group, grouppquota))
380        return groupsandquotas
381       
382    def addPrinter(self, printername) :       
383        """Adds a printer to the quota storage, returns it."""
384        self.doModify("INSERT INTO printers (printername) VALUES (%s)" % self.doQuote(printername))
385        return self.getPrinter(printername)
386       
387    def addUser(self, user) :       
388        """Adds a user to the quota storage, returns its id."""
389        self.doModify("INSERT INTO users (username, limitby, balance, lifetimepaid, email) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.Name), self.doQuote(user.LimitBy), self.doQuote(user.AccountBalance), self.doQuote(user.LifeTimePaid), self.doQuote(user.Email)))
390        return self.getUser(user.Name)
391       
392    def addGroup(self, group) :       
393        """Adds a group to the quota storage, returns its id."""
394        self.doModify("INSERT INTO groups (groupname, limitby) VALUES (%s, %s)" % (self.doQuote(group.Name), self.doQuote(group.LimitBy)))
395        return self.getGroup(group.Name)
396
397    def addUserToGroup(self, user, group) :   
398        """Adds an user to a group."""
399        result = self.doSearch("SELECT COUNT(*) AS mexists FROM groupsmembers WHERE groupid=%s AND userid=%s" % (self.doQuote(group.ident), self.doQuote(user.ident)))
400        try :
401            mexists = int(result[0].get("mexists"))
402        except (IndexError, TypeError) :   
403            mexists = 0
404        if not mexists :   
405            self.doModify("INSERT INTO groupsmembers (groupid, userid) VALUES (%s, %s)" % (self.doQuote(group.ident), self.doQuote(user.ident)))
406           
407    def addUserPQuota(self, user, printer) :
408        """Initializes a user print quota on a printer."""
409        self.doModify("INSERT INTO userpquota (userid, printerid) VALUES (%s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident)))
410        return self.getUserPQuota(user, printer)
411       
412    def addGroupPQuota(self, group, printer) :
413        """Initializes a group print quota on a printer."""
414        self.doModify("INSERT INTO grouppquota (groupid, printerid) VALUES (%s, %s)" % (self.doQuote(group.ident), self.doQuote(printer.ident)))
415        return self.getGroupPQuota(group, printer)
416       
417    def writePrinterPrices(self, printer) :   
418        """Write the printer's prices back into the storage."""
419        self.doModify("UPDATE printers SET priceperpage=%s, priceperjob=%s WHERE id=%s" % (self.doQuote(printer.PricePerPage), self.doQuote(printer.PricePerJob), self.doQuote(printer.ident)))
420       
421    def writeUserLimitBy(self, user, limitby) :   
422        """Sets the user's limiting factor."""
423        self.doModify("UPDATE users SET limitby=%s WHERE id=%s" % (self.doQuote(limitby), self.doQuote(user.ident)))
424       
425    def writeGroupLimitBy(self, group, limitby) :   
426        """Sets the group's limiting factor."""
427        self.doModify("UPDATE groups SET limitby=%s WHERE id=%s" % (self.doQuote(limitby), self.doQuote(group.ident)))
428       
429    def writeUserPQuotaDateLimit(self, userpquota, datelimit) :   
430        """Sets the date limit permanently for a user print quota."""
431        self.doModify("UPDATE userpquota SET datelimit=%s WHERE id=%s" % (self.doQuote(datelimit), self.doQuote(userpquota.ident)))
432           
433    def writeGroupPQuotaDateLimit(self, grouppquota, datelimit) :   
434        """Sets the date limit permanently for a group print quota."""
435        self.doModify("UPDATE grouppquota SET datelimit=%s WHERE id=%s" % (self.doQuote(datelimit), self.doQuote(grouppquota.ident)))
436       
437    def writeUserPQuotaPagesCounters(self, userpquota, newpagecounter, newlifepagecounter) :   
438       """Sets the new page counters permanently for a user print quota."""
439       self.doModify("UPDATE userpquota SET pagecounter=%s,lifepagecounter=%s WHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident)))
440       
441    def writeUserAccountBalance(self, user, newbalance, newlifetimepaid=None) :   
442       """Sets the new account balance and eventually new lifetime paid."""
443       if newlifetimepaid is not None :
444           self.doModify("UPDATE users SET balance=%s, lifetimepaid=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(newlifetimepaid), self.doQuote(user.ident)))
445       else :   
446           self.doModify("UPDATE users SET balance=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(user.ident)))
447           
448    def writeLastJobSize(self, lastjob, jobsize) :       
449        """Sets the last job's size permanently."""
450        self.doModify("UPDATE jobhistory SET jobsize=%s WHERE id=%s" % (self.doQuote(jobsize), self.doQuote(lastjob.ident)))
451       
452    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, filename=None, title=None, copies=None, options=None) :   
453        """Adds a job in a printer's history."""
454        if (not self.disablehistory) or (not printer.LastJob.Exists) :
455            if jobsize is not None :
456                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options)))
457            else :   
458                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, filename, title, copies, options) VALUES (%s, %s, %s, %s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options)))
459        else :       
460            # here we explicitly want to reset jobsize to NULL if needed
461            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobdate=now() WHERE id=%s;" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(printer.LastJob.ident)))
462           
463    def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) :
464        """Sets soft and hard limits for a user quota."""
465        self.doModify("UPDATE userpquota SET softlimit=%s, hardlimit=%s, datelimit=NULL WHERE id=%s" % (self.doQuote(softlimit), self.doQuote(hardlimit), self.doQuote(userpquota.ident)))
466       
467    def writeGroupPQuotaLimits(self, grouppquota, softlimit, hardlimit) :
468        """Sets soft and hard limits for a group quota on a specific printer."""
469        self.doModify("UPDATE grouppquota SET softlimit=%s, hardlimit=%s, datelimit=NULL WHERE id=%s" % (self.doQuote(softlimit), self.doQuote(hardlimit), self.doQuote(grouppquota.ident)))
470
471    def deleteUser(self, user) :   
472        """Completely deletes an user from the Quota Storage."""
473        # TODO : What should we do if we delete the last person who used a given printer ?
474        # TODO : we can't reassign the last job to the previous one, because next user would be
475        # TODO : incorrectly charged (overcharged).
476        for q in [ 
477                    "DELETE FROM groupsmembers WHERE userid=%s" % self.doQuote(user.ident),
478                    "DELETE FROM jobhistory WHERE userid=%s" % self.doQuote(user.ident),
479                    "DELETE FROM userpquota WHERE userid=%s" % self.doQuote(user.ident),
480                    "DELETE FROM users WHERE id=%s" % self.doQuote(user.ident),
481                  ] :
482            self.doModify(q)
483       
484    def deleteGroup(self, group) :   
485        """Completely deletes a group from the Quota Storage."""
486        for q in [
487                   "DELETE FROM groupsmembers WHERE groupid=%s" % self.doQuote(group.ident),
488                   "DELETE FROM grouppquota WHERE groupid=%s" % self.doQuote(group.ident),
489                   "DELETE FROM groups WHERE id=%s" % self.doQuote(group.ident),
490                 ] : 
491            self.doModify(q)
492       
Note: See TracBrowser for help on using the browser.