Ignore:
Timestamp:
23/04/08 09:56:50 (12 years ago)
Author:
cbyrom
Message:

Add default logging support + create new version of ingest script, removing
all traces of the eXist DB + improve documentation and output.

File:
1 edited

Legend:

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

    r3810 r3817  
    1 import sys 
    2 from Logger import Logger 
     1import sys, logging 
    32 
    43class SchemaNameSpace: 
     
    76    NB, only currently handles correction of DIF files 
    87    ''' 
    9     def __init__(self,infile,outfile,format, logger): 
     8    def __init__(self, infile, outfile, format): 
    109        ''' 
    1110        Constructor - with the logic to do the namespace change 
     
    1413        @param format: Format of file being processed.  DIF is the only format which currently is processed.    
    1514        ''' 
     15        logging.info("Correcting namespace in file, " + infile) 
     16             
    1617        self.ff=open(infile,'r') 
    1718        self.ww=open(outfile,'w') 
    1819        self.format= format 
    1920        self.lines=self.ff.readlines() 
     21         
    2022        for self.line in self.lines: 
    2123            if self.format== "DIF" and self.line.startswith('<DIF'): 
    22                 message = "INFO: changing line for %s. output to %s" %(infile,outfile) 
    23                 if (logger is None): 
    24                     print message 
    25                 else: 
    26                     logger.printOutput(message) 
     24                logging.info("changing line for %s. output to %s" %(infile,outfile)) 
    2725                self.line='<DIF xmlns="http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n' 
    2826            self.ww.write(self.line) 
    2927        self.ff.close() 
    3028        self.ww.close() 
     29 
     30        logging.info("Corrected file written to, " + outfile) 
Note: See TracChangeset for help on using the changeset viewer.