Re: PyDO 2.0b2 OneToMany with raw sql broken ? Partial fix.
Jacob Smullyan <[email protected]> Thu, 17 Nov 2005 12:15:40 -0500
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Nov 10, 2005 at 05:36:10PM -0500, Jonan Santiago wrote: > Hello, > When passing a string for raw sql where statements to OneToMany > attributes the function fails. Bugs are in the subfunction getMany(). Sorry for delay in getting back to this. > First some naming errors on line 929-930 which should be: > > conn=self.getDBI() > converter=conn.getConverter() Oops! > After fixing these the function/query fails with: > > TypeError: not all arguments converted during string formatting > > There is an extra bind value in 'extravalue' the result of > the second _processWhere() on line 932. So the foreignkey bind value > is repeated twice. I fixed this by resetting the converter after > the first _processWhere(). > > Not sure this fix is correct since I don't understand > everything going on with 'converter' and _processWhere() . It is admittedly confusing. I think the reset should work; also, it should work to simply let the converter accumulate the values and look only at the second set of values (the first should be a subset of the second). Since the reset involves less typing I'll try that, and add a test case. If you have a particular test that fails, that would be helpful. Thanks, j -- Jacob Smullyan ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click