def writeFile(self, filename): """ Write the parset to disk. """ outf = ropen(filename, 'w') # construct strings from key,value pairs lines = ["%s = %s" % (str(k),encode(v)) for k,v in self.iteritems()] # sort them for easy lookup lines.sort() # write them to file outf.write( "\n".join( lines ) ) if lines: outf.write( "\n" )
def readFile(self, filename): """ Read a parset to disk, and merge it with the current settings. """ f = ropen( filename, "r" ) self._readFile(f, filename)