Changeset 4224


Ignore:
Timestamp:
23/09/08 17:00:44 (11 years ago)
Author:
sdonegan
Message:

Added extra try-catch to deal with missing temporal coverage in original DIFs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/PostgresDAO.py

    r3972 r4224  
    161161        ''' 
    162162        logging.info("Adding spatiotemporal row to DB") 
     163         
    163164        sqlCmd = "SELECT add_spatiotemporal_row('" + str(self._record.db_id) + "', '" + \ 
    164165            str(coords.north) + "', '" + str(coords.south) + "', '" + str(coords.west) + "', '" + \ 
    165166            str(coords.east) + "', " 
     167             
     168             
    166169         
    167170        # cope with null dates appropriately 
     
    190193         
    191194        # Work out the relationship between the spatial and temporal data and handle appropriately 
    192         timeData = self._record.getTemporalData() 
     195         
     196        # error here! SJD - added a try/except to set timedata to null for instances where no temporal data in xml 
     197        # - should be caught elsewhere, but easiest fudge is to put it in here. 23/09/08 SJD. 
     198        try: 
     199            timeData = self._record.getTemporalData()  
     200        except: 
     201             
     202            timeData = [ TimeRange('null', 'null') ] 
     203             
    193204        spatialData = self._record.getSpatialData() 
    194          
     205        
    195206        # check if we have any spatiotemporal data to add; escape if not 
    196207        if not timeData and not spatialData: 
     
    204215        if not spatialData: 
    205216            spatialData = [ Coords('null', 'null', 'null', 'null') ] 
    206          
     217        
    207218        # if both arrays of data are the same length, assume they map together 
    208219        i = 0 
Note: See TracChangeset for help on using the changeset viewer.