Changeset 1259
- Timestamp:
- 01/08/04 17:33:27 (21 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storage.py
r1258 r1259 22 22 # 23 23 # $Log$ 24 # Revision 1.35 2004/01/08 16:33:27 jalet 25 # Additionnal check to not create a circular printers group. 26 # 24 27 # Revision 1.34 2004/01/08 16:24:49 jalet 25 28 # edpykota now supports adding printers to printer groups. … … 245 248 def addPrinterToGroup(self, printer) : 246 249 """Adds a printer to a printer group.""" 247 if printer not in self.parent.getParentPrinters(self) :250 if (printer not in self.parent.getParentPrinters(self)) and (printer.ident != self.ident) : 248 251 self.parent.writePrinterToGroup(self, printer) 249 252 -
pykota/trunk/pykota/storages/ldapstorage.py
r1258 r1259 22 22 # 23 23 # $Log$ 24 # Revision 1.46 2004/01/08 16:33:27 jalet 25 # Additionnal check to not create a circular printers group. 26 # 24 27 # Revision 1.45 2004/01/08 16:24:49 jalet 25 28 # edpykota now supports adding printers to printer groups. … … 821 824 def writePrinterToGroup(self, pgroup, printer) : 822 825 """Puts a printer into a printer group.""" 823 if (printer.ident not in pgroup.uniqueMember) and (printer.ident != pgroup.ident):826 if printer.ident not in pgroup.uniqueMember : 824 827 fields = { 825 828 "uniqueMember" : pgroup.uniqueMember + [printer.ident] -
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) :