Changeset 890 for pykota/trunk/bin/edpykota
- Timestamp:
- 04/08/03 23:10:18 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r886 r890 23 23 # 24 24 # $Log$ 25 # Revision 1.30 2003/04/08 21:10:18 jalet 26 # Checks --groups option presence instead of --users because --users is the default. 27 # 25 28 # Revision 1.29 2003/04/05 09:28:56 jalet 26 29 # Unnecessary message was logged … … 256 259 for (printer, printerpagecounter) in printernames : 257 260 if options["prototype"] : 258 if options["users"] : 261 if options["groups"] : 262 prototype = self.storage.getGroupPQuota(options["prototype"], printer) 263 else : 264 # default is user quota edition 259 265 prototype = self.storage.getUserPQuota(options["prototype"], printer) 260 else :261 prototype = self.storage.getGroupPQuota(options["prototype"], printer)262 266 if prototype is None : 263 267 self.logger.log_message(_("Prototype %s not found in Quota Storage for printer %s.") % (options["prototype"], printer)) … … 278 282 allnames = names 279 283 else : 280 if options["users"] : 284 if options["groups"] : 285 allnames = self.storage.getPrinterGroups(printer) 286 else : 281 287 allnames = self.storage.getPrinterUsers(printer) 282 else :283 allnames = self.storage.getPrinterGroups(printer)284 288 for name in [n for n in allnames if self.matchString(n, names)]: 285 if options["users"] : 289 if options["groups"] : 290 quota = self.storage.getGroupPQuota(name, printer) 291 else : 286 292 quota = self.storage.getUserPQuota(name, printer) 287 else :288 quota = self.storage.getGroupPQuota(name, printer)289 293 if quota is None : 290 294 # not found … … 294 298 # like /etc/passwd because users may be defined 295 299 # only remotely 296 if options["users"] : 300 if options["groups"] : 301 if self.isValidName(name) : 302 self.storage.addGroupPQuota(name, printer) 303 quota = self.storage.getGroupPQuota(name, printer) 304 else : 305 self.logger.log_message(_("Invalid group name %s") % name) 306 else : 297 307 if self.isValidName(name) : 298 308 self.storage.addUserPQuota(name, printer) … … 300 310 else : 301 311 self.logger.log_message(_("Invalid user name %s") % name) 302 else :303 if self.isValidName(name) :304 self.storage.addGroupPQuota(name, printer)305 quota = self.storage.getGroupPQuota(name, printer)306 else :307 self.logger.log_message(_("Invalid group name %s") % name)308 312 if quota is None : 309 313 self.logger.log_message(_("Quota not found for object %s on printer %s.") % (name, printer)) 310 314 else : 311 if options["users"] : 315 if options["groups"] : 316 if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) : 317 self.storage.setGroupPQuota(name, printer, softlimit, hardlimit) 318 if options["reset"] : 319 self.storage.resetGroupPQuota(name, printer) 320 else : 312 321 if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) : 313 322 self.storage.setUserPQuota(name, printer, softlimit, hardlimit) 314 323 if options["reset"] : 315 324 self.storage.resetUserPQuota(name, printer) 316 else :317 if options["noquota"] or ((softlimit is not None) and (hardlimit is not None)) :318 self.storage.setGroupPQuota(name, printer, softlimit, hardlimit)319 if options["reset"] :320 self.storage.resetGroupPQuota(name, printer)321 325 322 326 if __name__ == "__main__" :