Changeset 1902 for pykota

Show
Ignore:
Timestamp:
11/06/04 23:40:57 (20 years ago)
Author:
jalet
Message:

Safer code

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r1901 r1902  
    2424# 
    2525# $Log$ 
     26# Revision 1.77  2004/11/06 22:40:57  jalet 
     27# Safer code 
     28# 
    2629# Revision 1.76  2004/11/06 22:35:58  jalet 
    2730# Added a miniparser for IPP messages (RFC 2910). The job-originating-host-name 
     
    344347         
    345348    def getCupsConfigDirectives(self, directives=[]) : 
    346         """Retrieves some CUPS directives from its configuration file.""" 
     349        """Retrieves some CUPS directives from its configuration file. 
     350         
     351           Returns a mapping with lowercased directives as keys and  
     352           their setting as values. 
     353        """ 
    347354        dirvalues = {}  
    348355        cupsroot = os.environ.get("CUPS_SERVERROOT", "/etc/cups") 
     
    421428            else :     
    422429                self.logdebug("Parsing of IPP message file %s begins." % ippmessagefile) 
    423                 ippmessage = IPPMessage(ippdatafile.read()) 
    424                 self.logdebug("Parsing of IPP message file %s ends." % ippmessagefile) 
     430                try : 
     431                    ippmessage = IPPMessage(ippdatafile.read()) 
     432                except PyKotaIPPError, msg :     
     433                    self.printInfo("Error while parsing %s : %s" % (ippmessagefile, msg), "warn") 
     434                else :     
     435                    self.logdebug("Parsing of IPP message file %s ends." % ippmessagefile) 
    425436                ippdatafile.close() 
    426437