TaggedItemManager methods get_union_by_model and get_intersection_by_model
fail on MySQL if there are no matching tags. Sqlite doesn't exhibit the
behavior, but in any case the db query can be avoided using the same logic
applied in get_by_model (diff attached).
e.g. (where tag 'foo' does not exist):
>>> TaggedItem.objects.get_intersection_by_model(models.Image, 'foo')
ProgrammingError: (1064, "You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near ')\n AND `main_image`.`id` =
`tagging_taggeditem`.object_id\n GROUP' at line 4")
>>> TaggedItem.objects.get_union_by_model(models.Image, 'foo')
ProgrammingError: (1064, "You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near ')\n AND `main_image`.`id` =
`tagging_taggeditem`.object_id\n GROUP' at line 4")
Attached diff checks tag_count as in get_by_model and returns empty set.
Original issue reported on code.google.com by simi...@gmail.com on 11 Apr 2008 at 3:41
Original issue reported on code.google.com by
simi...@gmail.com
on 11 Apr 2008 at 3:41Attachments: