Closed Bug 763498 Opened 14 years ago Closed 14 years ago

MultipleObjectsReturned: get() returned more than one DocumentTag -- it returned 2! Lookup parameters were {'name': u'Testing'}

Categories

(developer.mozilla.org Graveyard :: Editing, defect, P2)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: groovecoder, Assigned: groovecoder)

References

Details

(Whiteboard: s= p=2)

Traceback (most recent call last): File "/data/www/developer.mozilla.org/kuma/vendor/src/django/django/core/handlers/base.py", line 100, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/data/www/developer.mozilla.org/kuma/vendor/src/django-waffle/waffle/decorators.py", line 20, in _wrapped_view return view(request, *args, **kwargs) File "/data/www/developer.mozilla.org/kuma/vendor/src/django/django/views/decorators/http.py", line 37, in inner return func(request, *args, **kwargs) File "/data/www/developer.mozilla.org/kuma/apps/wiki/views.py", line 626, in list_documents tag_obj = tag and get_object_or_404(DocumentTag, name=tag) or None File "/data/www/developer.mozilla.org/kuma/vendor/src/django/django/shortcuts/__init__.py", line 88, in get_object_or_404 return queryset.get(*args, **kwargs) File "/data/www/developer.mozilla.org/kuma/vendor/src/django/django/db/models/query.py", line 349, in get % (self.model._meta.object_name, num, kwargs)) MultipleObjectsReturned: get() returned more than one DocumentTag -- it returned 2! Lookup parameters were {'name': u'Testing'} <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{}, META:{ 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPS': 'on', 'HTTP_ACCEPT': '*/*', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_CONNECTION': 'Keep-alive', 'HTTP_FROM': 'googlebot(at)googlebot.com', 'HTTP_HOST': 'developer-new.mozilla.org', 'HTTP_SSLCLIENTCERTSTATUS': 'NoClientCert', 'HTTP_SSLCLIENTCIPHER': 'SSL_RSA_WITH_RC4_128_SHA, version=TLSv1, bits=128', 'HTTP_USER_AGENT': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', 'PATH_INFO': u'/en-US/docs/tag/Testing', 'PATH_TRANSLATED': '/data/www/developer.mozilla.org/kuma/wsgi/kuma.wsgi/en-US/docs/tag/Testing', 'QUERY_STRING': '', 'REMOTE_ADDR': '10.22.81.210', 'REMOTE_PORT': '64918', 'REQUEST_METHOD': 'GET', 'REQUEST_URI': '/en-US/docs/tag/Testing', 'SCRIPT_FILENAME': '/data/www/developer.mozilla.org/kuma/wsgi/kuma.wsgi', 'SCRIPT_NAME': u'', 'SCRIPT_URI': 'http://developer-new.mozilla.org/en-US/docs/tag/Testing', 'SCRIPT_URL': '/en-US/docs/tag/Testing', 'SERVER_ADDR': '10.22.81.18', 'SERVER_ADMIN': 'webmaster@mozilla.com', 'SERVER_NAME': 'developer-new.mozilla.org', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SIGNATURE': '', 'SERVER_SOFTWARE': 'Apache', 'mod_wsgi.application_group': 'developer.mozilla.org|', 'mod_wsgi.callable_object': 'application', 'mod_wsgi.handler_script': '', 'mod_wsgi.input_chunked': '0', 'mod_wsgi.listener_host': '', 'mod_wsgi.listener_port': '81', 'mod_wsgi.process_group': 'developer', 'mod_wsgi.request_handler': 'wsgi-script', 'mod_wsgi.script_reloading': '1', 'mod_wsgi.version': (3, 3), 'platform.name': 'developer1.webapp.scl3.mozilla.com', 'wsgi.errors': <mod_wsgi.Log object at 0x7f144b480df0>, 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7f144b407738>, 'wsgi.input': <mod_wsgi.Input object at 0x7f144b480530>, 'wsgi.loaded': datetime.datetime(2012, 6, 10, 5, 48, 23, 668134), 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'https', 'wsgi.version': (1, 1)}>
This might be related to something I saw last week: https://bugzilla.mozilla.org/show_bug.cgi?id=758377
Ugh. I suspect this has to do with case sensitivity. I wouldn't be surprised to see a "testing" and a "Testing" tag created, using case as-is. But, then a case-insensitive search used to look up a tag.
Resolved by Lucian here: https://bugzilla.mozilla.org/show_bug.cgi?id=758377 Thank you Lucian!
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
This is still happening. Looks like the new code prevents new duplicate tags being created, but I don't think the existing duplicate tags that cause the error have been cleaned up and the code still trips up on them.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Shouldn't these be removed manually though, Les?
If there's only a couple, sure. Otherwise, we need a django-south migration to do the cleanup. I haven't looked into it - only noting that the error is still happening.
Hmm, looks like there's no admin view for Document tags. So, probably a good idea to add that, but no way to manually resolve the duplicate tags in the meantime. Need to build a South migration that inventories duplicate tags and deletes one of each.
Whiteboard: s=2012-07-18
Whiteboard: s=2012-07-18 → s=2012-07-18 p=2
Assignee: nobody → lcrouch
Commits pushed to master at https://github.com/mozilla/kuma https://github.com/mozilla/kuma/commit/4ddb10f24a35945a69f9f3c2bfc6581169b0ced5 fix bug 763498 - clean up document tags with dupe names https://github.com/mozilla/kuma/commit/07effbcbce259494cc606669bb5e4cfc4837f991 Merge pull request #363 from groovecoder/clean-documenttags-763498 fix bug 763498 - clean up document tags with dupe names
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Grr.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Blocks: 771763
No longer blocks: 756263
Priority: -- → P2
Whiteboard: s=2012-07-18 p=2 → s= p=2
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Version: Kuma → unspecified
Component: Docs Platform → Editing
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.