Changeset 3130 for pykota/trunk/bin

Show
Ignore:
Timestamp:
01/09/07 14:33:21 (18 years ago)
Author:
stefan
Message:

Added a new -e | --email option to autopykota. It's now possible
to add a mail address to a new user on the fly.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/autopykota

    r3043 r3130  
    5151                       If the user already exists, actual balance is left 
    5252                       unmodified. If unset, the default value is 0. 
     53 
     54  -e | --email addr    Sets the user's e-mail address 
     55   
    5356""") 
    5457 
     
    7881            if not user.Exists : 
    7982                self.logdebug("Creating user %s which doesn't exist yet." % username) 
    80                 os.system('pkusers --add --limitby balance --balance "%s" --description "user created from autopykota" "%s"' % (options["initbalance"], username)) 
     83                if (options["email"] is None) : 
     84                    os.system('pkusers --add --limitby balance --balance "%s" --description "user created from autopykota" "%s"' % (options["initbalance"], username)) 
     85                else : 
     86                    os.system('pkusers --add --limitby balance --balance "%s" --email "%s" --description "user created from autopykota" "%s"' % (options["initbalance"], options["email"], username)) 
     87                     
    8188                user = self.storage.getUserFromBackend(username) 
    8289                if user.Exists : 
     
    109116                     "initbalance" : 0.0 
    110117                   } 
    111         short_options = "vhi:" 
    112         long_options = ["help", "version", "initbalance="] 
     118        short_options = "vhi:e:" 
     119        long_options = ["help", "version", "initbalance=", "email="] 
    113120         
    114121        # Initializes the command line tool 
     
    123130        options["version"] = options["v"] or options["version"] 
    124131        options["initbalance"] = options["i"] or options["initbalance"] or defaults["initbalance"] 
     132        options["email"] = options["e"] or options["email"] 
    125133         
    126134        if options["help"] :