msoulier
unread,Apr 18, 2009, 1:42:56 PM4/18/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
My production code is using Python 2.3 and Django 0.96. Yes, I know.
Next release picks up Django 1.0.2 and Python 2.4. Yay.
In the meantime, I have a custom model manager with a method that
executes custom sql. Works fine with PostgreSQL, but when I'm
developing with SQLite I get a traceback.
Traceback (most recent call last):
File "<console>", line 1, in ?
File "/home/msoulier/work/mitel-msl-tug/root/etc/e-smith/web/django/
teleworker/clients/models.py", line 43, in disconnectAll
cursor.execute("""
File "/home/msoulier/work/bin/msl8/lib/python2.3/site-packages/
django/db/backends/util.py", line 12, in execute
return self.cursor.execute(sql, params)
File "/home/msoulier/work/bin/msl8/lib/python2.3/site-packages/
django/db/backends/sqlite3/base.py", line 93, in execute
return Database.Cursor.execute(self, query, params)
Warning: You can only execute one statement at a time.
This is the method in question.
def disconnectAll(self, instanceid, nonlocal=False):
instanceid = int(instanceid)
cursor = connection.cursor()
log.debug("ClientManager.disconnectAll: disconnecting non-
local clients")
instance = TugInstance.objects.get(id=instanceid)
local_tugid = instance.tugid
log.debug("local tugid is %s" % local_tugid)
cursor.execute("""
BEGIN;
UPDATE clients
SET connected = 'false'
WHERE connected = 'true'
AND tugid <> %s;
COMMIT;""", [local_tugid])
Am I doing something wrong here?
Thanks,
Mike