Changeset 1099 for pykota/trunk/bin

Show
Ignore:
Timestamp:
07/25/03 12:41:30 (21 years ago)
Author:
jalet
Message:

Better documentation.
pykotme now displays the current user's account balance.
Some test changed in ldap module.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pykotme

    r1057 r1099  
    2323# 
    2424# $Log$ 
     25# Revision 1.2  2003/07/25 10:41:29  jalet 
     26# Better documentation. 
     27# pykotme now displays the current user's account balance. 
     28# Some test changed in ldap module. 
     29# 
    2530# Revision 1.1  2003/07/03 09:44:01  jalet 
    2631# Now includes the pykotme utility 
     
    3237import os 
    3338import pwd 
    34 import grp 
    3539 
    3640from pykota import version 
     
    116120                stream.close() 
    117121                 
     122        # get current user 
     123        uid = os.geteuid() 
     124        username = pwd.getpwuid(uid)[0] 
     125        user = self.storage.getUser(username) 
     126        if user.Exists and user.LimitBy and (user.LimitBy.lower() == "balance"): 
     127            print _("Your account balance : %.2f") % (user.AccountBalance or 0.0) 
     128             
    118129        printers = self.storage.getMatchingPrinters(options["printer"]) 
    119130        if not printers : 
    120131            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"] 
     132             
    121133        print _("Job size : %i pages") % nbpages     
    122134        for printer in printers :