Show
Ignore:
Timestamp:
02/13/05 23:02:29 (19 years ago)
Author:
jalet
Message:

Big database structure changes. Upgrade script is now included as well as
the new LDAP schema.
Introduction of the -o | --overcharge command line option to edpykota.
The output of repykota is more complete, but doesn't fit in 80 columns anymore.
Introduction of the new 'maxdenybanners' directive.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/reporter.py

    r1692 r2054  
    2222# 
    2323# $Log$ 
     24# Revision 1.11  2005/02/13 22:02:29  jalet 
     25# Big database structure changes. Upgrade script is now included as well as 
     26# the new LDAP schema. 
     27# Introduction of the -o | --overcharge command line option to edpykota. 
     28# The output of repykota is more complete, but doesn't fit in 80 columns anymore. 
     29# Introduction of the new 'maxdenybanners' directive. 
     30# 
    2431# Revision 1.10  2004/09/02 10:09:30  jalet 
    2532# Fixed bug in LDAP user deletion code which didn't correctly delete the user's 
     
    8794    def getReportHeader(self) :         
    8895        if self.isgroup : 
    89             return _("Group           used    soft    hard    balance grace         total       paid") 
     96            return _("Group          overcharge   used    soft    hard    balance grace         total       paid warn") 
    9097        else :     
    91             return _("User            used    soft    hard    balance grace         total       paid") 
     98            return _("User           overcharge   used    soft    hard    balance grace         total       paid warn") 
    9299             
    93100    def getPrinterRealPageCounter(self, printer) :         
     
    109116        balance = float(entry.AccountBalance or 0.0) 
    110117        lifetimepaid = float(entry.LifeTimePaid or 0.0) 
     118        if not hasattr(entry, "OverCharge") : 
     119            overcharge = _("N/A")       # Not available for groups 
     120        else :     
     121            overcharge = float(entry.OverCharge or 0.0) 
     122        if not hasattr(quota, "WarnCount") :     
     123            warncount = _("N/A")        # Not available for groups 
     124        else :     
     125            warncount = int(quota.WarnCount or 0) 
    111126         
    112127        #balance 
     
    199214        strbalance = ("%5.2f" % balance)[:10] 
    200215        strlifetimepaid = ("%6.2f" % lifetimepaid)[:10] 
    201         return (lifepagecounter, lifetimepaid, entry.Name, reached, pagecounter, str(quota.SoftLimit), str(quota.HardLimit), strbalance, str(datelimit)[:10], lifepagecounter, strlifetimepaid) 
     216        strovercharge = ("%5s" % overcharge)[:5] 
     217        strwarncount = ("%4s" % warncount)[:4] 
     218        return (lifepagecounter, lifetimepaid, entry.Name, reached, \ 
     219                pagecounter, str(quota.SoftLimit), str(quota.HardLimit), \ 
     220                strbalance, str(datelimit)[:10], lifepagecounter, \ 
     221                strlifetimepaid, strovercharge, strwarncount) 
    202222         
    203223def openReporter(tool, reporttype, printers, ugnames, isgroup) :