Changeset 2706 for pykota/trunk/bin
- Timestamp:
- 02/17/06 23:51:17 (19 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkusers
r2705 r2706 297 297 usersgroups = [] 298 298 299 if options["description"] : 299 description = options["description"] 300 if description : 300 301 description = options["description"].strip() 302 303 comment = options["comment"] 304 if comment : 305 comment = options["comment"].strip() 301 306 302 307 nbtotal = len(entries) 303 308 for i in range(nbtotal) : 304 309 entry = entries[i] 305 if description is not None : 310 if description is not None : # NB : "" is allowed ! 306 311 entry.setDescription(description) 312 if limitby : 313 entry.setLimitBy(limitby) 314 315 if suffix == "User" : 316 if overcharge is not None : # NB : 0 is allowed ! 317 entry.setOverChargeFactor(overcharge) 318 307 319 entry.save() 308 if not options["groups"] : 320 321 if suffix == "User" : 322 if balance : 323 if balance.startswith("+") or balance.startswith("-") : 324 newbalance = float(entry.AccountBalance or 0.0) + balancevalue 325 newlifetimepaid = float(entry.LifeTimePaid or 0.0) + balancevalue 326 entry.setAccountBalance(newbalance, newlifetimepaid, comment) 327 else : 328 diff = balancevalue - float(entry.AccountBalance or 0.0) 329 newlifetimepaid = float(entry.LifeTimePaid or 0.0) + diff 330 entry.setAccountBalance(balancevalue, newlifetimepaid, comment) 331 309 332 for ugroup in usersgroups : 310 333 if options["remove"] : … … 312 335 else : 313 336 ugroup.addUserToGroup(entry) 337 314 338 percent = 100.0 * float(i) / float(nbtotal) 315 339 self.display("\r%.02f%%" % percent)