root / pykota / trunk / pykota / storages / sql.py @ 1332

Revision 1332, 25.0 kB (checked in by jalet, 20 years ago)

pkprinters can now remove printers from printers groups.

  • 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-2004 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.36  2004/02/04 13:24:41  jalet
25# pkprinters can now remove printers from printers groups.
26#
27# Revision 1.35  2004/02/04 11:17:00  jalet
28# pkprinters command line tool added.
29#
30# Revision 1.34  2004/02/02 22:44:16  jalet
31# Preliminary work on Relationnal Database Independance via DB-API 2.0
32#
33#
34#
35
36from pykota.storage import PyKotaStorageError,BaseStorage,StorageObject,StorageUser,StorageGroup,StoragePrinter,StorageJob,StorageLastJob,StorageUserPQuota,StorageGroupPQuota
37
38class SQLStorage :
39    def getAllUsersNames(self) :   
40        """Extracts all user names."""
41        usernames = []
42        result = self.doSearch("SELECT username FROM users")
43        if result :
44            usernames = [record["username"] for record in result]
45        return usernames
46       
47    def getAllGroupsNames(self) :   
48        """Extracts all group names."""
49        groupnames = []
50        result = self.doSearch("SELECT groupname FROM groups")
51        if result :
52            groupnames = [record["groupname"] for record in result]
53        return groupnames
54       
55    def getUserFromBackend(self, username) :   
56        """Extracts user information given its name."""
57        user = StorageUser(self, username)
58        result = self.doSearch("SELECT * FROM users WHERE username=%s LIMIT 1" % self.doQuote(username))
59        if result :
60            fields = result[0]
61            user.ident = fields.get("id")
62            user.LimitBy = fields.get("limitby")
63            user.AccountBalance = fields.get("balance")
64            user.LifeTimePaid = fields.get("lifetimepaid")
65            user.Email = fields.get("email")
66            user.Exists = 1
67        return user
68       
69    def getGroupFromBackend(self, groupname) :   
70        """Extracts group information given its name."""
71        group = StorageGroup(self, groupname)
72        result = self.doSearch("SELECT * FROM groups WHERE groupname=%s LIMIT 1" % self.doQuote(groupname))
73        if result :
74            fields = result[0]
75            group.ident = fields.get("id")
76            group.LimitBy = fields.get("limitby")
77            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))
78            if result :
79                fields = result[0]
80                group.AccountBalance = fields.get("balance")
81                group.LifeTimePaid = fields.get("lifetimepaid")
82            group.Exists = 1
83        return group
84       
85    def getPrinterFromBackend(self, printername) :       
86        """Extracts printer information given its name."""
87        printer = StoragePrinter(self, printername)
88        result = self.doSearch("SELECT * FROM printers WHERE printername=%s LIMIT 1" % self.doQuote(printername))
89        if result :
90            fields = result[0]
91            printer.ident = fields.get("id")
92            printer.PricePerJob = fields.get("priceperjob")
93            printer.PricePerPage = fields.get("priceperpage")
94            printer.LastJob = self.getPrinterLastJob(printer)
95            printer.Exists = 1
96        return printer   
97       
98    def getUserPQuotaFromBackend(self, user, printer) :       
99        """Extracts a user print quota."""
100        userpquota = StorageUserPQuota(self, user, printer)
101        if printer.Exists and user.Exists :
102            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)))
103            if result :
104                fields = result[0]
105                userpquota.ident = fields.get("id")
106                userpquota.PageCounter = fields.get("pagecounter")
107                userpquota.LifePageCounter = fields.get("lifepagecounter")
108                userpquota.SoftLimit = fields.get("softlimit")
109                userpquota.HardLimit = fields.get("hardlimit")
110                userpquota.DateLimit = fields.get("datelimit")
111                userpquota.Exists = 1
112        return userpquota
113       
114    def getGroupPQuotaFromBackend(self, group, printer) :       
115        """Extracts a group print quota."""
116        grouppquota = StorageGroupPQuota(self, group, printer)
117        if group.Exists :
118            result = self.doSearch("SELECT id, softlimit, hardlimit, datelimit FROM grouppquota WHERE groupid=%s AND printerid=%s" % (self.doQuote(group.ident), self.doQuote(printer.ident)))
119            if result :
120                fields = result[0]
121                grouppquota.ident = fields.get("id")
122                grouppquota.SoftLimit = fields.get("softlimit")
123                grouppquota.HardLimit = fields.get("hardlimit")
124                grouppquota.DateLimit = fields.get("datelimit")
125                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)))
126                if result :
127                    fields = result[0]
128                    grouppquota.PageCounter = fields.get("pagecounter")
129                    grouppquota.LifePageCounter = fields.get("lifepagecounter")
130                grouppquota.Exists = 1
131        return grouppquota
132       
133    def getPrinterLastJobFromBackend(self, printer) :       
134        """Extracts a printer's last job information."""
135        lastjob = StorageLastJob(self, printer)
136        result = self.doSearch("SELECT jobhistory.id, jobid, userid, username, pagecounter, jobsize, jobprice, filename, title, copies, options, jobdate FROM jobhistory, users WHERE printerid=%s AND userid=users.id ORDER BY jobdate DESC LIMIT 1" % self.doQuote(printer.ident))
137        if result :
138            fields = result[0]
139            lastjob.ident = fields.get("id")
140            lastjob.JobId = fields.get("jobid")
141            lastjob.User = self.getUser(fields.get("username"))
142            lastjob.PrinterPageCounter = fields.get("pagecounter")
143            lastjob.JobSize = fields.get("jobsize")
144            lastjob.JobPrice = fields.get("jobprice")
145            lastjob.JobAction = fields.get("action")
146            lastjob.JobFileName = fields.get("filename")
147            lastjob.JobTitle = fields.get("title")
148            lastjob.JobCopies = fields.get("copies")
149            lastjob.JobOptions = fields.get("options")
150            lastjob.JobDate = fields.get("jobdate")
151            lastjob.Exists = 1
152        return lastjob
153           
154    def getGroupMembersFromBackend(self, group) :       
155        """Returns the group's members list."""
156        groupmembers = []
157        result = self.doSearch("SELECT * FROM groupsmembers JOIN users ON groupsmembers.userid=users.id WHERE groupid=%s" % self.doQuote(group.ident))
158        if result :
159            for record in result :
160                user = StorageUser(self, record.get("username"))
161                user.ident = record.get("userid")
162                user.LimitBy = record.get("limitby")
163                user.AccountBalance = record.get("balance")
164                user.LifeTimePaid = record.get("lifetimepaid")
165                user.Email = record.get("email")
166                user.Exists = 1
167                groupmembers.append(user)
168                self.cacheEntry("USERS", user.Name, user)
169        return groupmembers       
170       
171    def getUserGroupsFromBackend(self, user) :       
172        """Returns the user's groups list."""
173        groups = []
174        result = self.doSearch("SELECT groupname FROM groupsmembers JOIN groups ON groupsmembers.groupid=groups.id WHERE userid=%s" % self.doQuote(user.ident))
175        if result :
176            for record in result :
177                groups.append(self.getGroup(record.get("groupname")))
178        return groups       
179       
180    def getParentPrintersFromBackend(self, printer) :   
181        """Get all the printer groups this printer is a member of."""
182        pgroups = []
183        result = self.doSearch("SELECT groupid,printername FROM printergroupsmembers JOIN printers ON groupid=id WHERE printerid=%s" % self.doQuote(printer.ident))
184        if result :
185            for record in result :
186                if record["groupid"] != printer.ident : # in case of integrity violation
187                    parentprinter = self.getPrinter(record.get("printername"))
188                    if parentprinter.Exists :
189                        pgroups.append(parentprinter)
190        return pgroups
191       
192    def getMatchingPrinters(self, printerpattern) :
193        """Returns the list of all printers for which name matches a certain pattern."""
194        printers = []
195        # We 'could' do a SELECT printername FROM printers WHERE printername LIKE ...
196        # but we don't because other storages semantics may be different, so every
197        # storage should use fnmatch to match patterns and be storage agnostic
198        result = self.doSearch("SELECT * FROM printers")
199        if result :
200            for record in result :
201                if self.tool.matchString(record["printername"], printerpattern.split(",")) :
202                    printer = StoragePrinter(self, record["printername"])
203                    printer.ident = record.get("id")
204                    printer.PricePerJob = record.get("priceperjob")
205                    printer.PricePerPage = record.get("priceperpage")
206                    printer.LastJob = self.getPrinterLastJob(printer)
207                    printer.Exists = 1
208                    printers.append(printer)
209                    self.cacheEntry("PRINTERS", printer.Name, printer)
210        return printers       
211       
212    def getPrinterUsersAndQuotas(self, printer, names=["*"]) :       
213        """Returns the list of users who uses a given printer, along with their quotas."""
214        usersandquotas = []
215        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))
216        if result :
217            for record in result :
218                if self.tool.matchString(record.get("username"), names) :
219                    user = StorageUser(self, record.get("username"))
220                    user.ident = record.get("uid")
221                    user.LimitBy = record.get("limitby")
222                    user.AccountBalance = record.get("balance")
223                    user.LifeTimePaid = record.get("lifetimepaid")
224                    user.Email = record.get("email") 
225                    user.Exists = 1
226                    userpquota = StorageUserPQuota(self, user, printer)
227                    userpquota.ident = record.get("id")
228                    userpquota.PageCounter = record.get("pagecounter")
229                    userpquota.LifePageCounter = record.get("lifepagecounter")
230                    userpquota.SoftLimit = record.get("softlimit")
231                    userpquota.HardLimit = record.get("hardlimit")
232                    userpquota.DateLimit = record.get("datelimit")
233                    userpquota.Exists = 1
234                    usersandquotas.append((user, userpquota))
235                    self.cacheEntry("USERS", user.Name, user)
236                    self.cacheEntry("USERPQUOTAS", "%s@%s" % (user.Name, printer.Name), userpquota)
237        return usersandquotas
238               
239    def getPrinterGroupsAndQuotas(self, printer, names=["*"]) :       
240        """Returns the list of groups which uses a given printer, along with their quotas."""
241        groupsandquotas = []
242        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))
243        if result :
244            for record in result :
245                if self.tool.matchString(record.get("groupname"), names) :
246                    group = self.getGroup(record.get("groupname"))
247                    grouppquota = self.getGroupPQuota(group, printer)
248                    groupsandquotas.append((group, grouppquota))
249        return groupsandquotas
250       
251    def addPrinter(self, printername) :       
252        """Adds a printer to the quota storage, returns it."""
253        self.doModify("INSERT INTO printers (printername) VALUES (%s)" % self.doQuote(printername))
254        return self.getPrinter(printername)
255       
256    def addUser(self, user) :       
257        """Adds a user to the quota storage, returns its id."""
258        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)))
259        return self.getUser(user.Name)
260       
261    def addGroup(self, group) :       
262        """Adds a group to the quota storage, returns its id."""
263        self.doModify("INSERT INTO groups (groupname, limitby) VALUES (%s, %s)" % (self.doQuote(group.Name), self.doQuote(group.LimitBy)))
264        return self.getGroup(group.Name)
265
266    def addUserToGroup(self, user, group) :   
267        """Adds an user to a group."""
268        result = self.doSearch("SELECT COUNT(*) AS mexists FROM groupsmembers WHERE groupid=%s AND userid=%s" % (self.doQuote(group.ident), self.doQuote(user.ident)))
269        try :
270            mexists = int(result[0].get("mexists"))
271        except (IndexError, TypeError) :   
272            mexists = 0
273        if not mexists :   
274            self.doModify("INSERT INTO groupsmembers (groupid, userid) VALUES (%s, %s)" % (self.doQuote(group.ident), self.doQuote(user.ident)))
275           
276    def addUserPQuota(self, user, printer) :
277        """Initializes a user print quota on a printer."""
278        self.doModify("INSERT INTO userpquota (userid, printerid) VALUES (%s, %s)" % (self.doQuote(user.ident), self.doQuote(printer.ident)))
279        return self.getUserPQuota(user, printer)
280       
281    def addGroupPQuota(self, group, printer) :
282        """Initializes a group print quota on a printer."""
283        self.doModify("INSERT INTO grouppquota (groupid, printerid) VALUES (%s, %s)" % (self.doQuote(group.ident), self.doQuote(printer.ident)))
284        return self.getGroupPQuota(group, printer)
285       
286    def writePrinterPrices(self, printer) :   
287        """Write the printer's prices back into the storage."""
288        self.doModify("UPDATE printers SET priceperpage=%s, priceperjob=%s WHERE id=%s" % (self.doQuote(printer.PricePerPage), self.doQuote(printer.PricePerJob), self.doQuote(printer.ident)))
289       
290    def writeUserLimitBy(self, user, limitby) :   
291        """Sets the user's limiting factor."""
292        self.doModify("UPDATE users SET limitby=%s WHERE id=%s" % (self.doQuote(limitby), self.doQuote(user.ident)))
293       
294    def writeGroupLimitBy(self, group, limitby) :   
295        """Sets the group's limiting factor."""
296        self.doModify("UPDATE groups SET limitby=%s WHERE id=%s" % (self.doQuote(limitby), self.doQuote(group.ident)))
297       
298    def writeUserPQuotaDateLimit(self, userpquota, datelimit) :   
299        """Sets the date limit permanently for a user print quota."""
300        self.doModify("UPDATE userpquota SET datelimit=%s WHERE id=%s" % (self.doQuote(datelimit), self.doQuote(userpquota.ident)))
301           
302    def writeGroupPQuotaDateLimit(self, grouppquota, datelimit) :   
303        """Sets the date limit permanently for a group print quota."""
304        self.doModify("UPDATE grouppquota SET datelimit=%s WHERE id=%s" % (self.doQuote(datelimit), self.doQuote(grouppquota.ident)))
305       
306    def increaseUserPQuotaPagesCounters(self, userpquota, nbpages) :   
307        """Increase page counters for a user print quota."""
308        self.doModify("UPDATE userpquota SET pagecounter=pagecounter+%s,lifepagecounter=lifepagecounter+%s WHERE id=%s" % (self.doQuote(nbpages), self.doQuote(nbpages), self.doQuote(userpquota.ident)))
309       
310    def writeUserPQuotaPagesCounters(self, userpquota, newpagecounter, newlifepagecounter) :   
311        """Sets the new page counters permanently for a user print quota."""
312        self.doModify("UPDATE userpquota SET pagecounter=%s,lifepagecounter=%s WHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident)))
313       
314    def decreaseUserAccountBalance(self, user, amount) :   
315        """Decreases user's account balance from an amount."""
316        self.doModify("UPDATE users SET balance=balance-%s WHERE id=%s" % (self.doQuote(amount), self.doQuote(user.ident)))
317       
318    def writeUserAccountBalance(self, user, newbalance, newlifetimepaid=None) :   
319        """Sets the new account balance and eventually new lifetime paid."""
320        if newlifetimepaid is not None :
321            self.doModify("UPDATE users SET balance=%s, lifetimepaid=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(newlifetimepaid), self.doQuote(user.ident)))
322        else :   
323            self.doModify("UPDATE users SET balance=%s WHERE id=%s" % (self.doQuote(newbalance), self.doQuote(user.ident)))
324           
325    def writeLastJobSize(self, lastjob, jobsize, jobprice) :       
326        """Sets the last job's size permanently."""
327        self.doModify("UPDATE jobhistory SET jobsize=%s, jobprice=%s WHERE id=%s" % (self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(lastjob.ident)))
328       
329    def writeJobNew(self, printer, user, jobid, pagecounter, action, jobsize=None, jobprice=None, filename=None, title=None, copies=None, options=None) :   
330        """Adds a job in a printer's history."""
331        if (not self.disablehistory) or (not printer.LastJob.Exists) :
332            if jobsize is not None :
333                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, jobsize, jobprice, filename, title, copies, options) VALUES (%s, %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(jobprice), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options)))
334            else :   
335                self.doModify("INSERT INTO jobhistory (userid, printerid, jobid, pagecounter, action, filename, title, copies, options) VALUES (%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(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options)))
336        else :       
337            # here we explicitly want to reset jobsize to NULL if needed
338            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobprice=%s, filename=%s, title=%s, copies=%s, options=%s, jobdate=now() WHERE id=%s" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options), self.doQuote(printer.LastJob.ident)))
339           
340    def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) :
341        """Sets soft and hard limits for a user quota."""
342        self.doModify("UPDATE userpquota SET softlimit=%s, hardlimit=%s, datelimit=NULL WHERE id=%s" % (self.doQuote(softlimit), self.doQuote(hardlimit), self.doQuote(userpquota.ident)))
343       
344    def writeGroupPQuotaLimits(self, grouppquota, softlimit, hardlimit) :
345        """Sets soft and hard limits for a group quota on a specific printer."""
346        self.doModify("UPDATE grouppquota SET softlimit=%s, hardlimit=%s, datelimit=NULL WHERE id=%s" % (self.doQuote(softlimit), self.doQuote(hardlimit), self.doQuote(grouppquota.ident)))
347
348    def writePrinterToGroup(self, pgroup, printer) :
349        """Puts a printer into a printer group."""
350        children = []
351        result = self.doSearch("SELECT printerid FROM printergroupsmembers WHERE groupid=%s" % self.doQuote(pgroup.ident))
352        if result :
353            for record in result :
354                children.append(record.get("printerid")) # TODO : put this into the database integrity rules
355        if printer.ident not in children :       
356            self.doModify("INSERT INTO printergroupsmembers (groupid, printerid) VALUES (%s, %s)" % (self.doQuote(pgroup.ident), self.doQuote(printer.ident)))
357       
358    def removePrinterFromGroup(self, pgroup, printer) :
359        """Removes a printer from a printer group."""
360        self.doModify("DELETE FROM printergroupsmembers WHERE groupid=%s AND printerid=%s" % (self.doQuote(pgroup.ident), self.doQuote(printer.ident)))
361       
362    def retrieveHistory(self, user=None, printer=None, datelimit=None, limit=100) :   
363        """Retrieves all print jobs for user on printer (or all) before date, limited to first 100 results."""
364        query = "SELECT jobhistory.*,username,printername FROM jobhistory,users,printers WHERE users.id=userid AND printers.id=printerid"
365        where = []
366        if (user is not None) and user.Exists :
367            where.append("userid=%s" % self.doQuote(user.ident))
368        if (printer is not None) and printer.Exists :
369            where.append("printerid=%s" % self.doQuote(printer.ident))
370        if datelimit is not None :   
371            where.append("jobdate<=%s" % self.doQuote(datelimit))
372        if where :   
373            query += " AND %s" % " AND ".join(where)
374        query += " ORDER BY id DESC"
375        if limit :
376            query += " LIMIT %s" % self.doQuote(int(limit))
377        jobs = []   
378        result = self.doSearch(query)   
379        if result :
380            for fields in result :
381                job = StorageJob(self)
382                job.ident = fields.get("id")
383                job.JobId = fields.get("jobid")
384                job.PrinterPageCounter = fields.get("pagecounter")
385                job.JobSize = fields.get("jobsize")
386                job.JobPrice = fields.get("jobprice")
387                job.JobAction = fields.get("action")
388                job.JobFileName = fields.get("filename")
389                job.JobTitle = fields.get("title")
390                job.JobCopies = fields.get("copies")
391                job.JobOptions = fields.get("options")
392                job.JobDate = fields.get("jobdate")
393                job.User = self.getUser(fields.get("username"))
394                job.Printer = self.getPrinter(fields.get("printername"))
395                job.Exists = 1
396                jobs.append(job)
397        return jobs
398       
399    def deleteUser(self, user) :   
400        """Completely deletes an user from the Quota Storage."""
401        # TODO : What should we do if we delete the last person who used a given printer ?
402        # TODO : we can't reassign the last job to the previous one, because next user would be
403        # TODO : incorrectly charged (overcharged).
404        for q in [ 
405                    "DELETE FROM groupsmembers WHERE userid=%s" % self.doQuote(user.ident),
406                    "DELETE FROM jobhistory WHERE userid=%s" % self.doQuote(user.ident),
407                    "DELETE FROM userpquota WHERE userid=%s" % self.doQuote(user.ident),
408                    "DELETE FROM users WHERE id=%s" % self.doQuote(user.ident),
409                  ] :
410            self.doModify(q)
411       
412    def deleteGroup(self, group) :   
413        """Completely deletes a group from the Quota Storage."""
414        for q in [
415                   "DELETE FROM groupsmembers WHERE groupid=%s" % self.doQuote(group.ident),
416                   "DELETE FROM grouppquota WHERE groupid=%s" % self.doQuote(group.ident),
417                   "DELETE FROM groups WHERE id=%s" % self.doQuote(group.ident),
418                 ] : 
419            self.doModify(q)
420           
421    def deletePrinter(self, printer) :   
422        """Completely deletes a printer from the Quota Storage."""
423        for q in [ 
424                    "DELETE FROM printergroupsmembers WHERE groupid=%s OR printerid=%s" % (self.doQuote(printer.ident), self.doQuote(printer.ident)),
425                    "DELETE FROM jobhistory WHERE printerid=%s" % self.doQuote(printer.ident),
426                    "DELETE FROM grouppquota WHERE printerid=%s" % self.doQuote(printer.ident),
427                    "DELETE FROM userpquota WHERE printerid=%s" % self.doQuote(printer.ident),
428                    "DELETE FROM printers WHERE id=%s" % self.doQuote(printer.ident),
429                  ] :
430            self.doModify(q)
431       
Note: See TracBrowser for help on using the browser.