> Okay, this seems to work for the use cases I submitted.
> Recently I've begun to use selectBy quite a bit, which excepted the
> attribute to be in the column list.
> 
> So, the following code is broken:
> 
> Employee.selectBy(person_attribute=...)
> 
> ForeignKey are also broken, neither obj or objID are queryable.
> 
> I'll see what I can do to solve that on top of your patch.

Rather tricky and the code is not easy to follow, understand or modify.

I testcase is attached to prove that I'm not dreaming.

Any hints on how to solve this?

Johan

Index: sqlobject/inheritance/tests/test_inherited_foreignKey.py
===================================================================
--- sqlobject/inheritance/tests/test_inherited_foreignKey.py    (revisão 5149)
+++ sqlobject/inheritance/tests/test_inherited_foreignKey.py    (cópia de 
trabalho)
@@ -35,3 +34,26 @@
     employee = EmployeeWithNotes.get(2)
     assert isinstance(employee, EmployeeWithNotes)
     assert employee.note.text == "employee"
+
+    persons = PersonWithNotes.select(PersonWithNotes.q.noteID <> None)
+    assert persons.count() == 2
+
+    persons = PersonWithNotes.selectBy(noteID=person.note.id)
+    assert persons.count() == 1
+
+    persons = EmployeeWithNotes.select(PersonWithNotes.q.noteID <> None)
+    assert persons.count() == 1
+
+    persons = PersonWithNotes.selectBy(noteID=person.note.id)
+    assert persons.count() == 1
+
+    # These three are broken
+    persons = EmployeeWithNotes.select(EmployeeWithNotes.q.noteID <> None)
+    assert persons.count() == 1
+
+    persons = PersonWithNotes.selectBy(note=person.note)
+    assert persons.count() == 1
+
+    persons = EmployeeWithNotes.selectBy(note=person.note)
+    assert persons.count() == 1
+
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to