Closed Bug 1396607 Opened 8 years ago Closed 8 years ago

Home page broken for logged-in users with no contributions

Categories

(Webtools Graveyard :: Pontoon, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adrian, Assigned: adrian)

References

Details

Attachments

(1 file)

Bug 1317230 broke the home page for authenticated users that have never contributed, for it tries to find their "top contributed locale", which does not exist. This bug is about fixing that issue. To reproduce, log in to pontoon as a user that has never contributed to any locale, and browse to the home page. Exception: webapp_1 | [ERROR:django.request] 2017-09-04 14:39:48,024 Internal Server Error: / webapp_1 | Traceback (most recent call last): webapp_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 42, in inner webapp_1 | response = get_response(request) webapp_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response webapp_1 | response = self._get_response(request) webapp_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response webapp_1 | response = self.process_exception_by_middleware(e, request) webapp_1 | File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response webapp_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) webapp_1 | File "/app/pontoon/base/views.py", line 67, in home webapp_1 | if user.top_contributed_locale: webapp_1 | File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", line 235, in inner webapp_1 | return func(self._wrapped, *args) webapp_1 | File "/app/pontoon/base/models.py", line 318, in top_contributed_locale webapp_1 | .first()['locale__code'] webapp_1 | TypeError: 'NoneType' object has no attribute '__getitem__'
Summary: Home page b → Home page broken for logged-in users with no contributions
Commit pushed to master at https://github.com/mozilla/pontoon https://github.com/mozilla/pontoon/commit/e99ed5beb2f3e9fac7035b1282e7fe8657134ae1 Fixes bug 1396607 - Fix error when a user has no contributions yet. (#699) Is a logged in user with no contributions to any locales tries to load the home page, it raises a 500 error. That is a regression, and is fixed by this commit.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: