IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 25, 2011, 4:19:47 PM (15 years ago)
Author:
rhenders
Message:

new method to check for header value and replace it with supplied default if and only if in test mode; also now reporting all missing dictionary fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/batch.py

    r31934 r31935  
    128128
    129129    '''
     130    Looks for a dictionary entry. If it is not there, then replaces it with the supplied default
     131    if, and only if, in test mode
     132    '''
     133    def safeDictionaryAccessWithDefault(self, header, key, default):
     134
     135         value = self.safeDictionaryAccess(header, key)
     136
     137         if value != "NULL": return value
     138         else:
     139             if not self.testMode: return "NULL"
     140             header[key] = default
     141             self.logger.infoPair("Hardcoding " + key + " to", header[key])
     142             return header[key]
     143
     144    '''
    130145    Returns the string value from this dictionary or else "NULL"
    131146    '''
     
    133148
    134149         if key in header: return header[key]
    135          else: return "NULL"
     150         else:
     151             self.logger.errorPair("Missing header field", key)
     152             return "NULL"
    136153
    137154    '''
Note: See TracChangeset for help on using the changeset viewer.