Changeset 1259 for pykota/trunk/pykota/storages/pgstorage.py
- Timestamp:
- 01/08/04 17:33:27 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/pgstorage.py
r1258 r1259 22 22 # 23 23 # $Log$ 24 # Revision 1.30 2004/01/08 16:33:27 jalet 25 # Additionnal check to not create a circular printers group. 26 # 24 27 # Revision 1.29 2004/01/08 16:24:49 jalet 25 28 # edpykota now supports adding printers to printer groups. … … 510 513 def writePrinterToGroup(self, pgroup, printer) : 511 514 """Puts a printer into a printer group.""" 512 self.doModify("INSERT INTO printergroupsmembers (groupid, printerid) VALUES (%s, %s);" % (self.doQuote(pgroup.ident), self.doQuote(printer.ident))) 515 children = [] 516 result = self.doSearch("SELECT printerid FROM printergroupsmembers WHERE groupid=%s;" % self.doQuote(pgroup.ident)) 517 if result : 518 for record in result : 519 children.append(record.get("printerid")) # TODO : put this into the database integrity rules 520 if printer.ident not in children : 521 self.doModify("INSERT INTO printergroupsmembers (groupid, printerid) VALUES (%s, %s);" % (self.doQuote(pgroup.ident), self.doQuote(printer.ident))) 513 522 514 523 def deleteUser(self, user) :