Show
Ignore:
Timestamp:
09/27/08 22:02:37 (16 years ago)
Author:
jerome
Message:

Removed unnecessary spaces at EOL.

Files:
1 modified

Legend:

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

    r3411 r3413  
    88# the Free Software Foundation, either version 3 of the License, or 
    99# (at your option) any later version. 
    10 #  
     10# 
    1111# This program is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    15 #  
     15# 
    1616# You should have received a copy of the GNU General Public License 
    1717# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    2828 
    2929from pykota.errors import PyKotaReporterError 
    30      
    31 class BaseReporter :     
     30 
     31class BaseReporter : 
    3232    """Base class for all reports.""" 
    3333    def __init__(self, tool, printers, ugnames, isgroup) : 
     
    3737        self.ugnames = ugnames 
    3838        self.isgroup = isgroup 
    39          
    40     def getPrinterTitle(self, printer) :      
     39 
     40    def getPrinterTitle(self, printer) : 
    4141        """Returns the formatted title for a given printer.""" 
    4242        return (_("Report for %s quota on printer %s") % ((self.isgroup and "group") or "user", printer.Name)) + (" (%s)" % printer.Description) 
    43          
    44     def getPrinterGraceDelay(self, printer) :     
     43 
     44    def getPrinterGraceDelay(self, printer) : 
    4545        """Returns the formatted grace delay for a given printer.""" 
    4646        return _("Pages grace time: %i days") % self.tool.config.getGraceDelay(printer.Name) 
    47          
    48     def getPrinterPrices(self, printer) :     
     47 
     48    def getPrinterPrices(self, printer) : 
    4949        """Returns the formatted prices for a given printer.""" 
    5050        return (_("Price per job: %.3f") % (printer.PricePerJob or 0.0), _("Price per page: %.3f") % (printer.PricePerPage or 0.0)) 
    51              
    52     def getReportHeader(self) :         
     51 
     52    def getReportHeader(self) : 
    5353        """Returns the correct header depending on users vs users groups.""" 
    5454        if self.isgroup : 
    5555            return _("Group          overcharge   used    soft    hard    balance grace         total       paid warn") 
    56         else :     
     56        else : 
    5757            return _("User           overcharge   used    soft    hard    balance grace         total       paid warn") 
    58              
    59     def getPrinterRealPageCounter(self, printer) :         
     58 
     59    def getPrinterRealPageCounter(self, printer) : 
    6060        """Returns the formatted real page counter for a given printer.""" 
    6161        msg = _("unknown") 
     
    6363            try : 
    6464                msg = "%9i" % printer.LastJob.PrinterPageCounter 
    65             except TypeError :      
     65            except TypeError : 
    6666                pass 
    6767        return _("Real : %s") % msg 
    68                  
    69     def getTotals(self, total, totalmoney) :             
     68 
     69    def getTotals(self, total, totalmoney) : 
    7070        """Returns the formatted totals.""" 
    7171        return (_("Total : %9i") % (total or 0.0), ("%11s" % ("%7.2f" % (totalmoney or 0.0))[:11])) 
    72              
     72 
    7373    def getQuota(self, entry, quota) : 
    7474        """Prints the quota information.""" 
     
    7979        if not hasattr(entry, "OverCharge") : 
    8080            overcharge = _("N/A")       # Not available for groups 
    81         else :     
     81        else : 
    8282            overcharge = float(entry.OverCharge or 0.0) 
    83         if not hasattr(quota, "WarnCount") :     
     83        if not hasattr(quota, "WarnCount") : 
    8484            warncount = _("N/A")        # Not available for groups 
    85         else :     
     85        else : 
    8686            warncount = int(quota.WarnCount or 0) 
    87          
     87 
    8888        if (not entry.LimitBy) or (entry.LimitBy.lower() == "quota") : 
    89             if (quota.HardLimit is not None) and (pagecounter >= quota.HardLimit) :     
     89            if (quota.HardLimit is not None) and (pagecounter >= quota.HardLimit) : 
    9090                datelimit = "DENY" 
    9191            elif (quota.HardLimit is None) and (quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) : 
     
    9696                if now >= datelimit : 
    9797                    datelimit = "DENY" 
    98             else :     
     98            else : 
    9999                datelimit = "" 
    100100            reached = (((quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) and "+") or "-") + "Q" 
     
    106106                        datelimit = "DENY" 
    107107                        reached = "+B" 
    108                     else :     
     108                    else : 
    109109                        # overcharging by a negative or nul factor means user is always allowed to print 
    110110                        # TODO : do something when printer prices are negative as well ! 
     
    117117                    datelimit = "WARNING" 
    118118                    reached = "?B" 
    119                 else :     
     119                else : 
    120120                    datelimit = "" 
    121121                    reached = "-B" 
     
    130130                reached = "NP" 
    131131                datelimit = "DENY" 
    132              
     132 
    133133        strbalance = ("%5.2f" % balance)[:10] 
    134134        strlifetimepaid = ("%6.2f" % lifetimepaid)[:10] 
     
    139139                strbalance, str(datelimit)[:10], lifepagecounter, \ 
    140140                strlifetimepaid, strovercharge, strwarncount) 
    141          
     141 
    142142def openReporter(tool, reporttype, printers, ugnames, isgroup) : 
    143143    """Returns a reporter instance of the proper reporter.""" 
    144144    try : 
    145         reporterbackend = imp.load_source("reporterbackend",  
     145        reporterbackend = imp.load_source("reporterbackend", 
    146146                                           os.path.join(os.path.dirname(__file__), 
    147147                                                        "reporters", 
     
    149149    except ImportError : 
    150150        raise PyKotaReporterError, _("Unsupported reporter backend %s") % reporttype 
    151     else :     
     151    else : 
    152152        return reporterbackend.Reporter(tool, printers, ugnames, isgroup)