Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Bug 679193: Regardless of whether we ever work out a migration for ki…
Browse files Browse the repository at this point in the history
…lling the existing dupes, we need this to avoid creating new ones.
  • Loading branch information
ubernostrum committed Oct 14, 2011
1 parent d95b115 commit 85e7687
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/devmo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def profile_edit(request, username):

# Update tags from form fields
for field, tag_ns in field_to_tag_ns:
tags = parse_tags(form.cleaned_data.get(field, ''))
tags = [t.lower() for t in parse_tags(form.cleaned_data.get(field, ''))]
profile_new.tags.set_ns(tag_ns, *tags)

# Change the email address, if necessary.
Expand Down
13 changes: 9 additions & 4 deletions apps/taggit_extras/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ def all_ns(self, namespace=None):
# Namespace requested, so generate filtered set
# TODO: Do this in the DB query? Might not be worth it.
#
# TODO: this is a minimal band-aid fix applied for bug
# 679193; rather than properly solve duplicated tags and
# case-sensitivity, we just filter out the duplicates
# here.
# On databases with case-insensitive collation, we can end
# up with duplicate tags (the same tag, differing only by
# case, like 'javascript' and 'JavaScript') in some
# cases. The most common instance of this is user profile
# tags, which are coerced to lowercase on save to avoid
# the problem, but because there are a large number of
# these duplicates already existing, we do a quick filter
# here to ensure we don't return a bunch of dupes that
# differ only by case.
seen = []
results = []
for t in tags:
Expand Down

0 comments on commit 85e7687

Please sign in to comment.