Skip to content

Commit

Permalink
Fixed a bug
Browse files Browse the repository at this point in the history
Fixed an exception error that happens when someone adds a tag in a
different case, when a tag already exists in another case. In other
words when someone submits a new tag that creates the same slug as an
existing tag.
  • Loading branch information
epicserve committed Jul 23, 2012
1 parent 87e64ea commit 30dd950
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion taggit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.db.models.query import QuerySet
from django.template.defaultfilters import slugify as default_slugify
from django.utils.translation import ugettext_lazy as _, ugettext
from psycopg2 import InternalError


class TagBase(models.Model):
Expand Down Expand Up @@ -39,7 +40,7 @@ def save(self, *args, **kwargs):
res = super(TagBase, self).save(*args, **kwargs)
transaction.savepoint_commit(sid, **trans_kwargs)
return res
except IntegrityError:
except (InternalError, IntegrityError):
transaction.savepoint_rollback(sid, **trans_kwargs)
self.slug = self.slugify(self.name, i)
else:
Expand Down

0 comments on commit 30dd950

Please sign in to comment.