From: <Z3...@us...> - 2010-09-05 00:48:15
|
Revision: 303 http://spd.svn.sourceforge.net/spd/?rev=303&view=rev Author: Z3po Date: 2010-09-05 00:48:09 +0000 (Sun, 05 Sep 2010) Log Message: ----------- change name of ConfigMofule Added Paths: ----------- branches/spd-ng/src/spdConfig.py Removed Paths: ------------- branches/spd-ng/src/Config.py Deleted: branches/spd-ng/src/Config.py =================================================================== --- branches/spd-ng/src/Config.py 2010-09-05 00:47:33 UTC (rev 302) +++ branches/spd-ng/src/Config.py 2010-09-05 00:48:09 UTC (rev 303) @@ -1,59 +0,0 @@ -from ConfigParser import RawConfigParser -import os -import sys - -class CONFIG: # {{{ - """This is the Configuration Module - You can read or set config options""" - - configfile = os.path.expanduser('~/.spd/config') - config = RawConfigParser() - - def ErrorHandler(self,message): - print message - sys.exit(2) - - def checkConfigFileWriteable(self): - if os.access(self.configfile,os.W_OK): - return True - else: - self.ErrorHandler(self.configfile + " Not WRITEABLE") - - def checkConfigFileReadable(self): - if os.access(self.configfile,os.R_OK): - self.config.read(self.configfile) - return self.config - else: - self.ErrorHandler(configfile + " NOT READABLE") - - def writeConfigFile(self,config): - configfile = open(self.configfile, 'wb') - try: - config.write(configfile) - except Exception, e: - self.ErrorHandler("An Error Occured" + str(e)) - - - def getSPDversion(self): - config = self.checkConfigFileReadable() - config.sections - if config.has_section("Main"): - if config.has_option("Main","version"): - return config.get("Main","version") - else: - self.ErrorHandler("Option version missing") - else: - self.ErrorHandler("Section Main missing") - - def setSPDversion(self,version): - self.checkConfigFileWriteable() - config = self.checkConfigFileReadable() - if config.has_section("Main"): - config.set("Main","version",version) - else: - self.ErrorHandler("Section Main missing") - self.writeConfigFile(config) -# }}} - -# EOF -# vim:foldmethod=marker:tabstop=3:autoindent:shiftwidth=3 Copied: branches/spd-ng/src/spdConfig.py (from rev 302, branches/spd-ng/src/Config.py) =================================================================== --- branches/spd-ng/src/spdConfig.py (rev 0) +++ branches/spd-ng/src/spdConfig.py 2010-09-05 00:48:09 UTC (rev 303) @@ -0,0 +1,59 @@ +from ConfigParser import RawConfigParser +import os +import sys + +class CONFIG: # {{{ + """This is the Configuration Module + You can read or set config options""" + + configfile = os.path.expanduser('~/.spd/config') + config = RawConfigParser() + + def ErrorHandler(self,message): + print message + sys.exit(2) + + def checkConfigFileWriteable(self): + if os.access(self.configfile,os.W_OK): + return True + else: + self.ErrorHandler(self.configfile + " Not WRITEABLE") + + def checkConfigFileReadable(self): + if os.access(self.configfile,os.R_OK): + self.config.read(self.configfile) + return self.config + else: + self.ErrorHandler(configfile + " NOT READABLE") + + def writeConfigFile(self,config): + configfile = open(self.configfile, 'wb') + try: + config.write(configfile) + except Exception, e: + self.ErrorHandler("An Error Occured" + str(e)) + + + def getSPDversion(self): + config = self.checkConfigFileReadable() + config.sections + if config.has_section("Main"): + if config.has_option("Main","version"): + return config.get("Main","version") + else: + self.ErrorHandler("Option version missing") + else: + self.ErrorHandler("Section Main missing") + + def setSPDversion(self,version): + self.checkConfigFileWriteable() + config = self.checkConfigFileReadable() + if config.has_section("Main"): + config.set("Main","version",version) + else: + self.ErrorHandler("Section Main missing") + self.writeConfigFile(config) +# }}} + +# EOF +# vim:foldmethod=marker:tabstop=3:autoindent:shiftwidth=3 Property changes on: branches/spd-ng/src/spdConfig.py ___________________________________________________________________ Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |