|
From: SourceForge.net <no...@so...> - 2003-12-18 01:14:36
|
Bugs item #788408, was opened at 2003-08-13 16:03 Message generated for change (Comment added) made by detrout You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=505345&aid=788408&group_id=63836 Category: Output: CreateDBAPI Group: None >Status: Closed Resolution: None Priority: 9 Submitted By: Brandon King (kingb) Assigned to: Diane Trout (detrout) Summary: DBAPI won't let you update an object more than once Initial Comment: The DBAPI only allows you to do an update on an object once. Let me explain with an example: Let's say you have a student object call stu. Then you set the name by calling stu.setFamilyName('Someone') and then commit it to the database... stu.commit(). Then you realize you want to chang the Family name to 'somebuddy' by stu.setFamilyName('Somebuddy') and then you call stu.commit(). You will find that the database record has not be updated. This bug is currently bipassable by retrieving the object from the database again (dbs.getObjectWhere(dbs.Students, 'student_pk = n')). Once you do this, you will only be able to make one update (commit) before you will have to retrive it from the database again... if you would like to make another change. ---------------------------------------------------------------------- >Comment By: Diane Trout (detrout) Date: 2003-12-17 17:14 Message: Logged In: YES user_id=122283 thanks to Luis Rodrigo Gallardo Cruz it's now fixed. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-12-17 10:10 Message: Logged In: NO The bug is caused by the definition of DBClass.commit() dbapi.py. Right now it reads: def commit(self, visited={}): This causes visited to *always* be the same dictionary object. A solution is to change the definition to def commit(self, visited=None): then add the line if visited == None: visited= {} and recursively pass visited on calls made from this method. Then, the user calls object.commit() wich causes a ney dictionary to be created, wich tracks calls and allows the recursion to end (as I suppose was the original intent for visited), but the dictionary gets destroyed after the call, which allows a new one to be created later, if the user wants to commit() again. I will implement this and send a patch as soon as possible. Rodrigo Gallardo ---------------------------------------------------------------------- Comment By: Brandon King (kingb) Date: 2003-10-02 18:34 Message: Logged In: YES user_id=552216 This bug is causing major problems with the BH project... Needs to be fixed ASAP. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=505345&aid=788408&group_id=63836 |