Changeset 3357

Show
Ignore:
Timestamp:
03/29/08 10:08:33 (17 years ago)
Author:
jerome
Message:

Less verbose now since some messages are now logged only at debug level.
Added a workaround for API mess.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/software.py

    r3288 r3357  
    7878    def withExternalScript(self) :     
    7979        """Does software accounting through an external script.""" 
    80         self.filter.printInfo(_("Launching SOFTWARE(%s)...") % self.arguments) 
     80        self.filter.logdebug(_("Launching SOFTWARE(%s)...") % self.arguments) 
    8181        pagecounter = None 
    8282        child = os.popen(self.arguments, "r") 
     
    8585        except (IOError, OSError), msg :     
    8686            msg = "%s : %s" % (self.arguments, msg)  
    87             self.filter.printInfo(_("Unable to compute job size with accounter %s") % msg) 
     87            self.filter.printInfo(_("Unable to compute job size with accounter %s") % msg, "warn") 
    8888        else :     
    8989            lines = [l.strip() for l in answer.split("\n")] 
     
    9292                    pagecounter = int(lines[i]) 
    9393                except (AttributeError, ValueError) : 
    94                     self.filter.printInfo(_("Line [%s] skipped in accounter's output. Trying again...") % lines[i]) 
     94                    self.filter.logdebug(_("Line [%s] skipped in accounter's output. Trying again...") % lines[i]) 
    9595                else :     
    9696                    break 
     
    102102        except TypeError :         
    103103            pass # None means no error occured. 
    104         self.filter.printInfo(_("Software accounter %s exit code is %s") % (self.arguments, str(status))) 
     104        self.filter.logdebug(_("Software accounter %s exit code is %s") % (self.arguments, str(status))) 
    105105             
    106106        if pagecounter is None :     
     
    113113             
    114114        pagecounter = pagecounter or 0     
    115         if self.filter.Ticket.FileName is not None : 
    116             # when a filename is passed as an argument, the backend  
    117             # must generate the correct number of copies. 
    118             pagecounter *= self.filter.Ticket.Copies 
     115        try : 
     116            if self.filter.Ticket.FileName is not None : 
     117                # when a filename is passed as an argument, the backend  
     118                # must generate the correct number of copies. 
     119                pagecounter *= self.filter.Ticket.Copies 
     120        except AttributeError :         
     121            pass # when called from pykotme. TODO : clean this mess some day. 
    119122                         
    120123        return pagecounter