We've been getting server errors when pages without tags are copied.
I think I've traced the problem to contrib/taggit.py, where the passed tags value is a tuple consisting of an empty FakeQuerySet instance, which raises a ValueError such as this:
ValueError: Cannot add [] (<class 'modelcluster.queryset.FakeQuerySet'>). Expected <class 'django.db.models.base.ModelBase'> or str.
I can get the process to complete without error by adding this check to _ClusterTaggableManager's add method:
def add(self, *tags):
if not tags[0]:
return
if TAGGIT_VERSION >= (1, 3, 0):
tag_objs = self._to_tag_model_instances(tags, {})
else:
tag_objs = self._to_tag_model_instances(tags)
If this is acceptable, and isn't a known issue or something that would be better addressed elsewhere, I'd be happy to open a PR.
We are running these versions:
- wagtail==2.10.1
- Django==2.2.16
- Python 3.6.3
We've been getting server errors when pages without tags are copied.
I think I've traced the problem to contrib/taggit.py, where the passed
tagsvalue is a tuple consisting of an empty FakeQuerySet instance, which raises a ValueError such as this:I can get the process to complete without error by adding this check to _ClusterTaggableManager's
addmethod:If this is acceptable, and isn't a known issue or something that would be better addressed elsewhere, I'd be happy to open a PR.
We are running these versions: