Changeset 890 for pykota/trunk
- Timestamp:
- 04/08/03 23:10:18 (22 years ago)
- Location:
- pykota/trunk/bin
- Files:
-
- 3 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__" : -
pykota/trunk/bin/repykota
r873 r890 23 23 # 24 24 # $Log$ 25 # Revision 1.18 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.17 2003/03/29 13:45:27 jalet 26 29 # GPL paragraphs were incorrectly (from memory) copied into the sources. … … 147 150 print _("Pages grace time: %idays") % self.config.getGraceDelay(printer) 148 151 total = 0 149 if options["users"] : 152 if options["groups"] : 153 print _("Group used soft hard grace total") 154 print "------------------------------------------------------------" 155 for name in self.storage.getPrinterGroups(printer) : 156 quota = self.storage.getGroupPQuota(name, printer) 157 total += self.printQuota(name, quota) 158 else : 159 # default is user quota report 150 160 print _("User used soft hard grace total") 151 161 print "------------------------------------------------------------" 152 162 for name in self.storage.getPrinterUsers(printer) : 153 163 quota = self.storage.getUserPQuota(name, printer) 154 total += self.printQuota(name, quota)155 else :156 print _("Group used soft hard grace total")157 print "------------------------------------------------------------"158 for name in self.storage.getPrinterGroups(printer) :159 quota = self.storage.getGroupPQuota(name, printer)160 164 total += self.printQuota(name, quota) 161 165 if total : -
pykota/trunk/bin/warnpykota
r873 r890 23 23 # 24 24 # $Log$ 25 # Revision 1.12 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.11 2003/03/29 13:45:27 jalet 26 29 # GPL paragraphs were incorrectly (from memory) copied into the sources. … … 129 132 raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 130 133 for (printer, printerpagecounter) in printernames : 131 if options["users"] : 134 if options["groups"] : 135 for name in self.storage.getPrinterGroups(printer) : 136 self.warnGroupPQuota(name, printer) 137 else : 132 138 for name in self.storage.getPrinterUsers(printer) : 133 139 self.warnUserPQuota(name, printer) 134 else :135 for name in self.storage.getPrinterGroups(printer) :136 self.warnGroupPQuota(name, printer)137 140 138 141 if __name__ == "__main__" :