Show
Ignore:
Timestamp:
02/16/06 21:24:39 (18 years ago)
Author:
jerome
Message:

Option --list now works for pkusers.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkusers

    r2699 r2701  
    195195                         
    196196            if options["list"] : 
    197                 for entry in entries : 
    198                     print "%s - <%s>" % (entry.Name, entry.Email) 
     197                if suffix == "User" : 
     198                    maildomain = self.config.getMailDomain() 
     199                    smtpserver = self.config.getSMTPServer() 
     200                    for entry in entries : 
     201                        email = entry.Email 
     202                        if not email : 
     203                            if maildomain :      
     204                                email = "%s@%s" % (entry.Name, maildomain) 
     205                            elif smtpserver :     
     206                                email = "%s@%s" % (entry.Name, smtpserver) 
     207                            else :     
     208                                email = "%s@%s" % (entry.Name, "localhost") 
     209                        msg = "%s - <%s>" % (entry.Name, email) 
     210                        if entry.Description : 
     211                            msg += " - %s" % entry.Description 
     212                        print msg     
     213                        print "    %s" % (_("Limited by : %s") % entry.LimitBy) 
     214                        print "    %s" % (_("Account balance : %.2f") % (entry.AccountBalance or 0.0)) 
     215                        print "    %s" % (_("Total paid so far : %.2f") % (entry.LifeTimePaid or 0.0)) 
     216                        print "    %s" % (_("Overcharging factor : %.2f") % entry.OverCharge) 
     217                else :     
     218                    for entry in entries : 
     219                        msg = "%s" % entry.Name 
     220                        if entry.Description : 
     221                            msg += " - %s" % entry.Description 
     222                        print msg     
     223                        print "    %s" % (_("Limited by : %s") % entry.LimitBy) 
     224                        print "    %s" % (_("Group balance : %.2f") % (entry.AccountBalance or 0.0)) 
     225                        print "    %s" % (_("Total paid so far : %.2f") % (entry.LifeTimePaid or 0.0)) 
    199226            else : 
    200227                self.display("%s...\n" % _("Modification")) 
     
    312339        elif (options["delete"] and (options["add"] or options["groups"] or options["remove"] or options["description"])) \ 
    313340           or (options["skipexisting"] and not options["add"]) \ 
    314            or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["remove"] or options["description"])) \ 
     341           or (options["list"] and (options["add"] or options["delete"] or options["remove"] or options["description"])) \ 
    315342           or (options["groups"] and (options["balance"] or options["ingroups"] or options["overcharge"])) : 
    316343            raise PyKotaCommandLineError, _("incompatible options, see help.")