132 | | nbtotal = len(billingcodes) |
133 | | for i in range(nbtotal) : |
134 | | billingcode = billingcodes[i] |
135 | | if options["list"] : |
136 | | print "%s [%s] %s %s %s %.2f %s" % \ |
137 | | (billingcode.BillingCode, billingcode.Description, \ |
138 | | billingcode.PageCounter, \ |
139 | | _("pages"), \ |
140 | | _("and"), \ |
141 | | billingcode.Balance, \ |
142 | | _("credits")) |
143 | | else : |
144 | | if options["reset"] : |
145 | | billingcode.reset() |
146 | | if options["description"] is not None : |
147 | | billingcode.setDescription(options["description"].strip()) |
148 | | billingcode.save() |
149 | | percent = 100.0 * float(i) / float(nbtotal) |
150 | | self.display("\r%.02f%%" % percent) |
| 132 | if (not options["add"]) \ |
| 133 | or options["description"] or options["reset"] : # optimize when nothing to do |
| 134 | nbtotal = len(billingcodes) |
| 135 | for i in range(nbtotal) : |
| 136 | billingcode = billingcodes[i] |
| 137 | if options["list"] : |
| 138 | print "%s [%s] %s %s %s %.2f %s" % \ |
| 139 | (billingcode.BillingCode, billingcode.Description, \ |
| 140 | billingcode.PageCounter, \ |
| 141 | _("pages"), \ |
| 142 | _("and"), \ |
| 143 | billingcode.Balance, \ |
| 144 | _("credits")) |
| 145 | else : |
| 146 | if options["reset"] : |
| 147 | billingcode.reset() |
| 148 | if options["description"] is not None : |
| 149 | billingcode.setDescription(options["description"].strip()) |
| 150 | billingcode.save() |
| 151 | percent = 100.0 * float(i) / float(nbtotal) |
| 152 | self.display("\r%.02f%%" % percent) |