Skip to content

Commit

Permalink
2011-03-20 Tom <[email protected]>
Browse files Browse the repository at this point in the history
	* src/lib/version.py (version): Version --> 0.15.9

	* src/lib/shopgui.py (ShopGui.show): Make sure window shows up
	when something's added.

	* src/lib/backends/db.py (RecData.initialize_connection): Remove
	threadlocal strategy. This may be a mistake, but it seems to clear
	up the commit errors numerous people were experiencing.

	* src/lib/shopgui.py (ShopGui.__init__): Make sure popup menu gets
	set-up for changing categories in shopping list.
  • Loading branch information
thinkle committed Mar 20, 2011
1 parent 02cc79e commit b72b368
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib/backends/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,12 @@ def initialize_connection (self):
#print 'Connecting to file ',self.filename,'new=',self.new_db
else:
self.new_db = True # ??? How will we do this now?
self.db = sqlalchemy.create_engine(self.url,strategy='threadlocal')
self.db.begin()
print self.url
#self.db = sqlalchemy.create_engine(self.url,strategy='threadlocal')
#self.base_connection = self.db
self.db = sqlalchemy.create_engine(self.url)
self.base_connection = self.db.connect()
self.base_connection.begin()
self.metadata = sqlalchemy.MetaData(self.db)
# Be noisy... (uncomment for debugging/fiddling)
# self.metadata.bind.echo = True
Expand All @@ -202,7 +206,7 @@ def instr(s,subs): return s.lower().find(subs.lower())+1
#c = sqlite_connection.cursor()
#c.execute('select name from sqlite_master')
#sqlite_connection.create_function('instr',2,instr)
self.db.commit() # Somehow necessary to prevent "DB Locked" errors
#self.base_connection.commit() # Somehow necessary to prevent "DB Locked" errors
debug('Done initializing DB connection',1)

def save (self):
Expand All @@ -221,7 +225,8 @@ def save (self):
{'last_access':time.time()}
)
try:
self.db.commit()
#self.base_connection.commit()
pass
except IndexError:
print 'Ignoring sqlalchemy problem'
import traceback; traceback.print_exc()
Expand Down

0 comments on commit b72b368

Please sign in to comment.