Bugs item #1356639, was opened at 2005-11-14 18:52
Message generated for change (Comment added) made by phd
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1356639&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: SQLObject from repository
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: darkmyst (darkmyst)
>Assigned to: Oleg Broytmann (phd)
Summary: delJoin errors when adding and deleting multiple joins
Initial Comment:
I'm using SQLObject 0.7.0 but I looked at what's in the
repository and the situation is the same there.
I've encountered a situation, in testing my code, where
I add a few joins to a table using sqlmeta.addJoin and
then immediately remove them using sqlmeta.delJoin. In
running the code I got the following error:
File
"/usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/main.py",
line 525, in delJoin
if joinDef is join.joinDef:
AttributeError: 'NoneType' object has no attribute
'joinDef'
Both my addJoins went off without a hitch and the first
delJoin as well. The second dellJoin is what tripped
the error. Looking into it, I found that
sqlmeta.addJoin uses a list to maintain joins (main.py,
line 481) and then uses the index on the list as the
reference point for a specific join (main.py, line
489). Therefore, as noted in delJoin (main.py, line
537), one can't just del the join from the list or
it'll screw up the indexing. The problem seems to be
in the for loop that checks to see if the join we want
removed is present (main.py, line 525):
524: for join in sqlmeta.joins:
525: if joinDef is join.joinDef:
526: break
If a join has previously been removed, it's set to
None. However, in the if statement we see it's assumed
that join will have an attribute joinDef. NoneType
doesn't have an attribute joinDef, hence the error.
Perhaps it should look more like:
524: for join in sqlmeta.joins:
525: if join is None:
526: continue
527: if joinDef is join.joinDef:
528: break
----------------------------------------------------------------------
>Comment By: Oleg Broytmann (phd)
Date: 2006-01-03 14:37
Message:
Logged In: YES
user_id=4799
Fixed by the patch 1356651.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1356639&group_id=74338
|