Changeset 2783 for pykota/trunk/bin
- Timestamp:
- 03/05/06 09:36:47 (18 years ago)
- Location:
- pykota/trunk/bin
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r2782 r2783 177 177 178 178 if not options["list"] : 179 self.display(_("Extracting datas...")) 179 percent = Percent(self) 180 percent.display(_("Extracting datas...")) 180 181 printers = self.storage.getMatchingPrinters(options["printer"]) 181 182 entries = getattr(self.storage, "getMatching%ss" % suffix)(",".join(names)) 183 if not options["list"] : 184 percent.setSize(len(printers) * len(entries)) 182 185 183 186 if options["list"] : … … 197 200 print 198 201 elif options["delete"] : 199 percent = Percent(self, "\n%s..." % _("Deletion"), len(printers) * len(entries))202 percent.display("\n%s..." % _("Deletion")) 200 203 getattr(self.storage, "deleteMany%sPQuotas" % suffix)(printers, entries) 201 204 percent.display("\n") … … 252 255 try : 253 256 if options["add"] : 254 percent = Percent(self, "\n%s...\n" % _("Creation"), len(printers) * len(entries))257 percent.display("\n%s...\n" % _("Creation")) 255 258 dicnames = {} 256 259 for m in entries : … … 284 287 percent.oneMore() 285 288 else : 286 percent = Percent(self, "\n%s...\n" % _("Modification"), len(entries) * len(printers))289 percent.display("\n%s...\n" % _("Modification")) 287 290 for printer in printers : 288 291 for entry in entries : … … 302 305 self.storage.commitTransaction() 303 306 304 try:307 if not options["list"] : 305 308 percent.done() 306 except NameError :307 pass308 309 309 310 if __name__ == "__main__" : -
pykota/trunk/bin/pkbcodes
r2782 r2783 97 97 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command.")) 98 98 99 if not options["list"] : 100 percent = Percent(self) 101 99 102 if not options["add"] : 100 103 if not options["list"] : 101 self.display(_("Extracting datas..."))104 percent.display(_("Extracting datas...")) 102 105 if not names : # NB : can't happen for --delete because it's catched earlier 103 106 names = ["*"] … … 105 108 if not billingcodes : 106 109 raise PyKotaCommandLineError, _("There's no billingcode matching %s") % " ".join(names) 110 if not options["list"] : 111 percent.setSize(len(billingcodes)) 107 112 108 113 if options["list"] : … … 116 121 _("credits")) 117 122 elif options["delete"] : 118 percent = Percent(self, "\n%s..." % _("Deletion"), len(billingcodes))123 percent.display("\n%s..." % _("Deletion")) 119 124 self.storage.deleteManyBillingCodes(billingcodes) 120 125 percent.display("\n") … … 129 134 try : 130 135 if options["add"] : 131 percent = Percent(self, "%s...\n" % _("Creation"), len(names)) 136 percent.display("%s...\n" % _("Creation")) 137 percent.setSize(len(names)) 132 138 for bname in names : 133 139 billingcode = StorageBillingCode(self.storage, bname) … … 143 149 percent.oneMore() 144 150 else : 145 percent = Percent(self, "\n%s...\n" % _("Modification"), len(billingcodes))151 percent.display("\n%s...\n" % _("Modification")) 146 152 for billingcode in billingcodes : 147 153 self.modifyBillingCode(billingcode, reset, description) … … 154 160 self.storage.commitTransaction() 155 161 156 try:162 if not options["list"] : 157 163 percent.done() 158 except NameError :159 pass160 164 161 165 if __name__ == "__main__" : -
pykota/trunk/bin/pkprinters
r2782 r2783 150 150 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], _("You're not allowed to use this command.")) 151 151 152 if not options["list"] : 153 percent = Percent(self) 154 152 155 if not options["add"] : 153 156 if not options["list"] : 154 self.display(_("Extracting datas..."))157 percent.display(_("Extracting datas...")) 155 158 if not names : # NB : can't happen for --delete because it's catched earlier 156 159 names = ["*"] … … 158 161 if not printers : 159 162 raise PyKotaCommandLineError, _("There's no printer matching %s") % " ".join(names) 163 if not options["list"] : 164 percent.setSize(len(printers)) 160 165 161 166 if options["list"] : … … 171 176 print 172 177 elif options["delete"] : 173 percent = Percent(self, "\n%s..." % _("Deletion"), len(printers))178 percent.display("\n%s..." % _("Deletion")) 174 179 self.storage.deleteManyPrinters(printers) 175 180 percent.display("\n") … … 217 222 try : 218 223 if options["add"] : 219 percent = Percent(self, "%s...\n" % _("Creation"), len(names)) 224 percent.display("%s...\n" % _("Creation")) 225 percent.setSize(len(names)) 220 226 for pname in names : 221 227 if self.isValidName(pname) : … … 244 250 percent.oneMore() 245 251 else : 246 percent = Percent(self, "\n%s...\n" % _("Modification"), len(printers))252 percent.display("\n%s...\n" % _("Modification")) 247 253 for printer in printers : 248 254 self.modifyPrinter(printer, charges, perpage, perjob, \ … … 258 264 self.storage.commitTransaction() 259 265 260 try:266 if not options["list"] : 261 267 percent.done() 262 except NameError :263 pass264 268 265 269 if __name__ == "__main__" : -
pykota/trunk/bin/pkusers
r2782 r2783 193 193 suffix = (options["groups"] and "Group") or "User" 194 194 195 if not options["list"] : 196 percent = Percent(self) 197 195 198 if not options["add"] : 196 199 if not options["list"] : 197 self.display(_("Extracting datas..."))200 percent.display(_("Extracting datas...")) 198 201 if not names : # NB : can't happen for --delete because it's catched earlier 199 202 names = ["*"] … … 201 204 if not entries : 202 205 raise PyKotaCommandLineError, _("There's no %s matching %s") % (_(suffix.lower()), " ".join(names)) 206 if not options["list"] : 207 percent.setSize(len(entries)) 203 208 204 209 if options["list"] : … … 235 240 print 236 241 elif options["delete"] : 237 percent = Percent(self, "\n%s..." % _("Deletion"), len(entries))242 percent.display("\n%s..." % _("Deletion")) 238 243 getattr(self.storage, "deleteMany%ss" % suffix)(entries) 239 244 percent.display("\n") … … 287 292 if options["add"] : 288 293 rejectunknown = self.config.getRejectUnknown() 289 percent = Percent(self, "%s...\n" % _("Creation"), len(names)) 294 percent.display("%s...\n" % _("Creation")) 295 percent.setSize(len(names)) 290 296 for ename in names : 291 297 email = None … … 347 353 percent.oneMore() 348 354 else : 349 percent = Percent(self, "\n%s...\n" % _("Modification"), len(entries))355 percent.display("\n%s...\n" % _("Modification")) 350 356 for entry in entries : 351 357 if groups : … … 364 370 self.storage.commitTransaction() 365 371 366 try:372 if not options["list"] : 367 373 percent.done() 368 except NameError :369 pass370 374 371 375 if __name__ == "__main__" :