Bug in deleteSome()
Stefan Neumann <[email protected]> Wed, 08 Jun 2005 19:50:28 +0200
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I am using the method deleteSome() in base.py but I got always the
Exception:
[..]
File "/usr/lib/python2.4/site-packages/PyDO2/base.py", line 543, in
deleteSome
return conn.execute(query, values)
File "/usr/lib/python2.4/site-packages/PyDO2/dbi.py", line 116, in execute
c.execute(sql)
File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 132,
in execute
self.errorhandler(self, TypeError, m)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line
33, in defaulterrorhandler
raise errorclass, errorvalue
TypeError: query() argument 1 must be string or read-only buffer, not list
So, I just switched to verbose mode to see the SQL-Statement:
DEBUG:PyDO2:SQL: ['DELETE FROM postfix_transport']
And actually in base.py I could see, that the query is a list. So I
copied from getSome() the line
query=' '.join(query)
I hope, I haven't made a mistake.
In case it is correct, I attached a patchfile. :-D
Best regards,
Stefan
--
Stefan Neumann
freiheit.com technologies gmbh
Straßenbahnring 22 / 20251 Hamburg, Germany
fon +49 (0)40 / 890584-0
fax +49 (0)40 / 890584-20
1CB2 BA3C 168F 0C2B 6005 FC5E 3EBA BCE2 1BF0 21D3
Bücher kaufen und Freie Software fördern | http://bookzilla.de/
deleteSome.patch
(text/plain, 445 B)
diff -r -u PyDO-2.0a2/src/PyDO2/base.py PyDO-2.0a2_new/src/PyDO2/base.py
--- PyDO-2.0a2/src/PyDO2/base.py 2005-05-12 16:48:32.000000000 +0200
+++ PyDO-2.0a2_new/src/PyDO2/base.py 2005-06-08 18:43:10.000000000 +0200
@@ -540,6 +540,7 @@
query=["DELETE FROM %s" % cls.getTable()]
if sql:
query.extend(['WHERE', sql])
+ query=' '.join(query)
return conn.execute(query, values)
def delete(self):
signature.asc
(application/pgp-signature, 256 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCpy/oPrq84hvwIdMRAiJpAKCQPMLPw1MGJ6/zMg6DQS55LqNbrwCdF8tm qF4MS9NXikJdcpQ+n9loF7I= =Q+xB -----END PGP SIGNATURE-----