On Mon, May 14, 2007 at 06:02:37PM +0400, Oleg Broytmann wrote:
> On Mon, May 14, 2007 at 03:38:40PM +0200, Tom Arild Naess wrote:
> > AttributeError: EndUser instance has no attribute 'eusUsrId'
>
> SingleJoin uses style.dbColumnToPythonAttr() to recreate python
> attribute names from the db name. In should find the real column and use
> whatever name it finds instead.
What do you think about the following patch?
Index: sqlobject/joins.py
===================================================================
--- sqlobject/joins.py (revision 2682)
+++ sqlobject/joins.py (working copy)
@@ -294,7 +294,10 @@
conn = inst._connection
else:
conn = None
- pythonColumn =
self.soClass.sqlmeta.style.dbColumnToPythonAttr(self.joinColumn)
+ for column in self.otherClass.sqlmeta.columns.values():
+ if column.dbName == self.joinColumn:
+ pythonColumn = column.name
+ break
results = self.otherClass.select(
getattr(self.otherClass.q, pythonColumn) == inst.id,
connection=conn
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss