This patch adds couple assertions in the testCircular test case in manytomany.py, and it fails:
Index: manytomany.py
===================================================================
--- manytomany.py (revision 690)
+++ manytomany.py (working copy)
@@ -125,10 +125,11 @@
p1.outputs.append(t1)
objectstore.commit()
-
-
l = Place.eagermapper.select()
print repr(l)
+
+ self.assert_result(t1, Transition, {'outputs': (Place, [{'name':'place3'}])})
+ self.assert_result(p2, Place, {'outputs': (Transition, [{'name':'transition1'}])})
if __name__ == "__main__":
testbase.main()
Any ideas?
On 12/3/05, Robert Leftwich <[EMAIL PROTECTED]> wrote:
Shuo Yang wrote:
> So either have one class eagerly loaded and the other lazily loaded like
> this:
>
> Student.mapper = mapper(Student, studentTbl)
> Course.mapper = mapper(Course, courseTbl)
>
> Student.mapper.add_property('courses',
> relation(Course.mapper, enrolTbl, lazy=True))
>
> Course.mapper.add_property('students',
> relation(Student.mapper, enrolTbl, lazy=False))
>
I'm obviously having a bad day - I had read the eager loading emails and because
of that I set my relations up as being not eager loading - or so I thought. For
some reason I saw lazy=False and read it as eager=False! Apologies for that!!!
Anyway after making one of the relations lazy, I now have a slightly different
problem in that the objectstore is not being updated correctly, e.g after
setting up a student and a course and adding the course to the student, i.e.
s1.courses.append(c1)
print len(s1.courses)
print len(c1.students)
objectstore.commit()
#objectstore.clear()
s = Student.mapper.select()
c = Course.mapper.select()
print 'Courses', s[0].courses
print 'Students', c[0].students
If I leave the clear() commented out the results is:
1
0
Courses [<__main__.Course object at 0xb7382d8c>]
Students []
which is incorrect, but if I uncomment the clear() it is:
Courses [<__main__.Course object at 0xb72a4dcc>]
Students [<__main__.Student object at 0xb72a4f8c>]
as expected.
Note that it doesn't matter which relation I make lazy, but the behaviour is
reversed if I add the student to the course instead of the course to the student.
Robert
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
--
---------------------------------------------------------------------------------------------------
John S. Yang

