sqlbuilder.Select looks like it's supposed to handle lists or tuples (although
yes, by type-checking). And then in __sqlrepr__ it appears it is using

things = self.items[:]

Presumably this is intended a) to make a copy so that appending to things
doesn't update self.items and b) to cast to a list so that append works?
Regardless, neither of these work for tuples: aTuple[:] returns the same
tuple, and returns a tuple. :)

changing that to

things = list(self.items)

should make it work.

- Luke

Quoting Gabe Rudy <[EMAIL PROTECTED]>:

>str(Select((Contact.q.id, Contact.q.firstName, Company.q.companyName),
Contact.q.companyID == Company.q.id))
  File "<stdin>", line 1, in ?
...
"/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1706-py2.4.egg/sqlobjec
t/sqlbuilder.py", line 452, in __sqlrepr__
    things.append(self.whereClause)
AttributeError: 'tuple' object has no attribute 'append'

I was hoping to get
'SELECT contact.id, contact.first_name, company.company_name FROM company,
contact WHERE ((contact.company_id) = (company.id))'


Well, after playing with it for a few more mintues, I figured it out:
str(Select([Contact.q.id, Contact.q.firstName, Company.q.companyName],
Contact.q.companyID == Company.q.id))

in fact does work. It appears that I needed to use a list [...] as the first
arg instead of a tuple (...)

So much for duck typing :) But I realize that a tuple is immutable and it
appears that SQLBuilder was attemping to use append.

--gabe


-------------------------------------------------------
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

Reply via email to