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/bin/pykotme

    r3411 r3413  
    99# the Free Software Foundation, either version 3 of the License, or 
    1010# (at your option) any later version. 
    11 #  
     11# 
    1212# This program is distributed in the hope that it will be useful, 
    1313# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1414# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1515# GNU General Public License for more details. 
    16 #  
     16# 
    1717# You should have received a copy of the GNU General Public License 
    1818# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3434from pykota.tool import PyKotaTool 
    3535from pykota.accounter import openAccounter 
    36      
    37 class PyKotMe(PyKotaTool) :         
     36 
     37class PyKotMe(PyKotaTool) : 
    3838    """A class for pykotme.""" 
    3939    def main(self, files, options) : 
     
    4646            # TODO : over the second printer below. 
    4747            files.append("-") 
    48              
     48 
    4949        printers = self.storage.getMatchingPrinters(options.printer) 
    5050        if not printers : 
    5151            raise PyKotaCommandLineError, _("There's no printer matching %s") % options.printer 
    52              
     52 
    5353        username = pwd.getpwuid(os.getuid())[0] 
    5454        if options.user : 
    5555            if not self.config.isAdmin : 
    5656                self.printInfo(_("The --user command line option will be ignored because you are not a PyKota Administrator."), "warn") 
    57             else :     
     57            else : 
    5858                username = options.user 
    59              
     59 
    6060        user = self.storage.getUser(username) 
    6161        if not user.Exists : 
    6262            self.printInfo(_("There's no user matching '%(username)s'.") \ 
    6363                                              % locals(), 
    64                            "error")                    
    65         else :                    
     64                           "error") 
     65        else : 
    6666            if user.LimitBy and (user.LimitBy.lower() == "balance"): 
    6767                self.display("%s\n" % (_("Your account balance : %.2f") % (user.AccountBalance or 0.0))) 
    68              
     68 
    6969            sizeprinted = False 
    7070            done = {} 
    7171            for printer in printers : 
    72                 # Now fake some values. TODO : improve API to not need this anymore     
     72                # Now fake some values. TODO : improve API to not need this anymore 
    7373                printername = printer.Name 
    7474                self.PrinterName = printer.Name 
     
    7777                key = self.preaccounter.name + self.preaccounter.arguments 
    7878                if not done.has_key(key) : 
    79                     totalsize = 0     
     79                    totalsize = 0 
    8080                    inkusage = [] 
    81                     for filename in files :     
     81                    for filename in files : 
    8282                        self.DataFile = filename 
    8383                        self.preaccounter.beginJob(None) 
     
    8585                        totalsize += self.preaccounter.getJobSize(None) 
    8686                        inkusage.extend(self.preaccounter.inkUsage) 
    87                     done[key] = (totalsize, inkusage)     
    88                 (totalsize, inkusage) = done[key]     
    89                 if not sizeprinted :     
     87                    done[key] = (totalsize, inkusage) 
     88                (totalsize, inkusage) = done[key] 
     89                if not sizeprinted : 
    9090                    self.display("%s\n" % (_("Job size : %i pages") % totalsize)) 
    9191                    sizeprinted = True 
     
    9494                    if printer.MaxJobSize and (totalsize > printer.MaxJobSize) : 
    9595                        self.display("%s\n" % (_("User %(username)s is not allowed to print so many pages on printer %(printername)s at this time.") % locals())) 
    96                     else :     
     96                    else : 
    9797                        cost = userpquota.computeJobPrice(totalsize, inkusage) 
    9898                        msg = _("Cost on printer %s : %.2f") % (printer.Name, cost) 
    9999                        if printer.PassThrough : 
    100100                            msg = "%s (%s)" % (msg, _("won't be charged, printer is in passthrough mode")) 
    101                         elif user.LimitBy == "nochange" :     
     101                        elif user.LimitBy == "nochange" : 
    102102                            msg = "%s (%s)" % (msg, _("won't be charged, account is immutable")) 
    103103                        self.display("%s\n" % msg) 
    104104            if user.LimitBy == "noprint" : 
    105105                self.display("%s\n" % (_("User %(username)s is forbidden to print at this time.") % locals())) 
    106              
    107 if __name__ == "__main__" :  
     106 
     107if __name__ == "__main__" : 
    108108    parser = PyKotaOptionParser(description=_("Generates print quotes for end users."), 
    109109                                usage="pykotme [options] [files]") 
     
    116116                            help=_("Acts on this user only. Only one username can be specified this way. The default value is the name of the user who launched this command. This option is ignored when the command is not launched by a PyKota Administrator.")) 
    117117 
    118     parser.add_example("--printer apple file1.ps <file2.pclxl",                             
     118    parser.add_example("--printer apple file1.ps <file2.pclxl", 
    119119                       _("This would show the number of pages needed to print these two files, as well as the cost of printing them to the 'apple' printer for the user who launched this command.")) 
    120120    parser.add_example("--user john",