Apologies as this is a repost, but I'm completely stuck!

I'm using django 1.0.2 and the tagging app to retrieve a tag via a
database "in" query, and something is causing the query results to be
discarded.

In particular, this line of code from tagging.utils.get_tag_list()
executes:

return Tag.objects.filter(name__in=[force_unicode(tag)
                          for tag in tags])

and at this point:
(Pdb) p tags
[u'sea']

The thread of execution can be traced into the method
django.db.models.sql.query.execute_sql(self, result_type=MULTI), and
to this line of code:

        cursor.execute(sql, params)

and over here:
>
c:\python26\lib\site-packages\django\db\models\sql\query.py(1735)
execute_sql()

-> cursor.execute(sql, params)
(Pdb) p sql
'SELECT "tagging_tag"."id", "tagging_tag"."name" FROM "tagging_tag"
WHERE "tagging_tag"."name" IN (%s) ORDER BY "tagging_tag"."name" ASC'
(Pdb) p params
(u'sea',)
(Pdb)

If I audit what's submitted to MySQL via MySQL logging, it reports:
SELECT `tagging_tag`.`id`, `tagging_tag`.`name` FROM `tagging_tag`
WHERE `tagging_tag`.`name` IN ('sea') ORDER BY `tagging_tag`.`name`
ASC

which looks correct - however django returns an empty list.

If I execute the query interactively in MySQL, I get the expected
(correct) result:

+----+------+
| id | name |
+----+------+
| 28 | Sea  |
+----+------+
1 row in set (0.00 sec)

I suspect this is a configuration problem but have no idea where to
look - can anyone help?

Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to