Going to need to know what that unhelpful exception message was, what version
of SQLObject, database, etc. Threw your code into a test file, using svn
SQLObject, sqlite and postgres, and it works fine:
[EMAIL PROTECTED]:~/code $ python2.4 -i test1.py
>>> me
<GroupMember 1L fullname='Matt Anderson' memberJIDID=1>
>>> me.memberJID
<JID 1L node='matt'>
>>>
- Luke
Quoting Matthew Anderson <[EMAIL PROTECTED]>:
> I've just had the frustrating experience of tracking down the cause
> of a random, unexpected exception that was being thrown.
>
> This doesn't work (and blows up with an unhelpful exception message):
>
> class JID(SQLObject):
> node = StringCol()
>
> class GroupMember(SQLObject):
> fullname = StringCol()
> memberJID = ForeignKey('JID')
>
> JID.createTable(ifNotExists=True)
> GroupMember.createTable(ifNotExists=True)
>
> myjid = JID(node="matt")#, domain="bebop", resource="")
> me = GroupMember(memberJID=myjid, fullname="Matt Anderson")
>
> and this does:
>
> class JID(SQLObject):
> node = StringCol()
>
> class GroupMember(SQLObject):
> fullname = StringCol()
> memberJID_ = ForeignKey('JID')
>
> JID.createTable(ifNotExists=True)
> GroupMember.createTable(ifNotExists=True)
>
> myjid = JID(node="matt")#, domain="bebop", resource="")
> me = GroupMember(memberJID_=myjid, fullname="Matt Anderson")
>
> The only difference is that in one case, I have a column variable
> named "memberJID" and in the other, a column variable named
> "memberJID_".
>
> After figuring this out, I carefully picked through the documentation
> at:
>
> http://www.sqlobject.org/SQLObject.html
>
> And it doesn't seem to be mentioned as a no-no, that you mustn't end
> any column names with "id". Is this a known (under-documented)
> issue, or is this a bug?
>
> I seem to be using SQLObject-0.7.1dev_r1675-py2.4.egg (installed by
> upgrading TurboGears I think).
>
> Thanks...
>
> --
> Matt Anderson
>
>
>
> 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
>
--
The Pursuit of Counterfactual Histories
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