コード例 #1
0
ファイル: sabx.py プロジェクト: jfarrimo/sabx
    def process_template(self):
        """
        Process the SABX 1.0 data into the template. First, delete the input
        file if it is the same as the output file.  This way you can read an
        SABX 1.0 file and write the template output to the same file name,
        effectively over-writing the file.
        """
        if self.options.in_file == self.options.out_file:
            os.unlink(self.options.in_file)

        TemplateProcessor.process_template(self)
コード例 #2
0
ファイル: sabx.py プロジェクト: jfarrimo/sabx
    def __init__(self, template_file=None, man=None):
        """
        Adds the "infile" command-line option specifying the SABX 1.0 file to
        read from to the options specified in the base class.

        @param template_file: (optional) path & file name of a template file
        @type template_file: C{string}
        @param man: (optional) extended program help information
        @type man: C{string}
        """
        TemplateProcessor.__init__(self, template_file, man)

        self.parser.add_option("-i", "--infile", dest="in_file",
                               help="input sabx data from FILE", 
                               metavar="FILE")