Changeset 2174


Ignore:
Timestamp:
Jan 27, 2010 12:31:26 PM (10 years ago)
Author:
wehart
Message:

Adding a hook for specifying the format for reading/writing IO formats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.opt/trunk/coopr/opt/colin/problem.py

    r1768 r2174  
    8686
    8787
    88     def main(self, argv):
     88    def main(self, argv, format=None):
    8989        """
    9090        The main routine for parsing the command-line and executing
     
    101101        # Parse XML input file
    102102        #
    103         input_doc = xml.dom.minidom.parse(argv[1])
    104         point = self.create_point(input_doc.getElementsByTagName("Domain")[0])
    105         self.validate(point)
    106         requests = self._handleRequests(input_doc.getElementsByTagName("Requests")[0])
     103        if format is None:
     104            input_doc = xml.dom.minidom.parse(argv[1])
     105            point = self.create_point(input_doc.getElementsByTagName("Domain")[0])
     106            self.validate(point)
     107            requests = self._handleRequests(input_doc.getElementsByTagName("Requests")[0])
    107108        #
    108109        # Create output XML object
    109110        #
    110         output_doc = self._process(point,requests)
    111111        OUTPUT = open(sys.argv[2],"w")
    112         output_doc.writexml(OUTPUT," "," ","\n","UTF-8")
     112        if format is None:
     113            output_doc = self._process(point,requests)
     114            output_doc.writexml(OUTPUT," "," ","\n","UTF-8")
    113115        OUTPUT.close()
    114116
Note: See TracChangeset for help on using the changeset viewer.