From: <Z3...@us...> - 2010-11-28 01:01:57
|
Revision: 318 http://spd.svn.sourceforge.net/spd/?rev=318&view=rev Author: Z3po Date: 2010-11-28 01:01:51 +0000 (Sun, 28 Nov 2010) Log Message: ----------- used atexit to make sure changes are written back upon exit Modified Paths: -------------- branches/spd-ng/src/spdCheck.py branches/spd-ng/src/spdConfig.py branches/spd-ng/src/spdCore.py branches/spd-ng/src/test.db Modified: branches/spd-ng/src/spdCheck.py =================================================================== --- branches/spd-ng/src/spdCheck.py 2010-09-15 20:01:33 UTC (rev 317) +++ branches/spd-ng/src/spdCheck.py 2010-11-28 01:01:51 UTC (rev 318) @@ -38,12 +38,12 @@ if config.hasSection("Main"): if config.getOption("Main","version"): version = config.getConfigVersion() - if version == "0.3": + if version == "0.3-alpha": pass else: config.ErrorHandler("Where you got THIS version from???\nCannot work with") else: - config.setConfigVersion("0.3") + config.setConfigVersion("0.3-alpha") else: config.setSection("Main") else: @@ -74,7 +74,8 @@ # config: the configparser to use""" config.setSection("Main") - config.setConfigVersion("0.3") + config.setConfigVersion("0.3-alpha") + config.setClientMode("CLI") # }}} # }}} Modified: branches/spd-ng/src/spdConfig.py =================================================================== --- branches/spd-ng/src/spdConfig.py 2010-09-15 20:01:33 UTC (rev 317) +++ branches/spd-ng/src/spdConfig.py 2010-11-28 01:01:51 UTC (rev 318) @@ -180,6 +180,14 @@ self.setOption("Main","version",version) # }}} + + def setClientMode(self,clientmode): # {{{ + """set the clientmode. + # clientmode: clientmode to use.""" + + self.setOption("Main","clientmode",clientmode) + # }}} + # }}} # EOF Modified: branches/spd-ng/src/spdCore.py =================================================================== --- branches/spd-ng/src/spdCore.py 2010-09-15 20:01:33 UTC (rev 317) +++ branches/spd-ng/src/spdCore.py 2010-11-28 01:01:51 UTC (rev 318) @@ -1,9 +1,15 @@ #!/usr/bin/python import sqlite3 +import atexit class Core(object): + # Writes back to the Store + def __commit(self): # {{{ + self.db.commit() + #}}} + # create the database from the stuff out of the store def __init__(self,ConfigSection='Main',PasswordColumn='Password'): # {{{ self.ConfigSection = ConfigSection @@ -13,15 +19,9 @@ self.dbc = self.db.cursor() self.deletedColumns = [] - + atexit.register(self.__commit) # Make Sure to Write back changes to sqldb exiting # }}} - # Writes back to the Store - def __del__(self): # {{{ - self.db.commit() - - #}}} - def __sql2dict(self,cursor,row): # {{{ result = {} for ColumnNr, Column in enumerate(cursor.description): @@ -31,7 +31,7 @@ # }}} - def searchEntry(self,SearchList): + def searchEntry(self,SearchList): # {{{ query = 'select * from ' + self.ConfigSection + ' where ' @@ -59,6 +59,7 @@ return result + # }}} def addEntry(self,NewDict): # {{{ query = 'insert into ' + self.ConfigSection + '( ' @@ -80,7 +81,6 @@ # }}} - def getColumns(self): # {{{ query = "pragma Table_info('" + self.ConfigSection + "')" Modified: branches/spd-ng/src/test.db =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |