Mercurial > pylearn
changeset 624:25d9f91f1afa
fixing session management in db dict update
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Sun, 18 Jan 2009 22:17:56 -0500 |
parents | ae954c27fd11 |
children | 123ca7751a80 ec27e19bb6eb |
files | pylearn/dbdict/api0.py |
diffstat | 1 files changed, 2 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/dbdict/api0.py Sun Jan 18 22:00:16 2009 -0500 +++ b/pylearn/dbdict/api0.py Sun Jan 18 22:17:56 2009 -0500 @@ -197,10 +197,7 @@ del d_self._attrs[i] if commit_close: s.commit() - #s.add(d_self) #why is this here? maybe it should go earlier?? s.close() - else: - pass def iteritems(d_self): return d_self.items() @@ -222,6 +219,7 @@ else: s = session commit_close = False + s.add(d_self) for k, v in dct.items(): d_self._set_in_session(k, v, s) for k, v in kwargs.items(): @@ -230,8 +228,6 @@ if commit_close: s.commit() s.close() - else: - s.add(d_self) #why is this here? maybe it should go earlier?? def get(d_self, key, default): try: @@ -284,7 +280,7 @@ if key == 'dbdict.status': ival = int(val) d_self.status = ival - if key == 'dbdict.priority': + if key == 'dbdict.sql.priority': fval = float(val) d_self.priority = fval