Using search term "a" results in a ISE on mozillians-dev

VERIFIED FIXED

Status

Participation Infrastructure
Phonebook
VERIFIED FIXED
6 years ago
6 years ago

People

(Reporter: aakashd, Assigned: tofumatt)

Tracking

Details

(Reporter)

Description

6 years ago
Steps to Reproduce:
1. Go to https://mozillians-dev.allizom.org/en-US/search?q=a

Actual Results:
I get a ISE

Expected Results:
A search results page for the term "a".

Notes: This happened on Chrome and Firefox. Searches for ".", "aa", "aakash", "b" and "c" worked fine.
The accompanying traceback: /en-US/search?q=a


Traceback (most recent call last):

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/django/django/core/handlers/base.py", line 111, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/django/django/contrib/auth/decorators.py", line 19, in _wrapped_view
   return view_func(request, *args, **kwargs)

 File "/data/www/mozillians-dev.allizom.org/mozillians/apps/phonebook/views.py", line 33, in wrapped
   return f(request, *args, **kwargs)

 File "/data/www/mozillians-dev.allizom.org/mozillians/apps/phonebook/views.py", line 153, in search
   return render(request, 'phonebook/search.html', d)

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/django/django/shortcuts/__init__.py", line 44, in render
   return HttpResponse(loader.render_to_string(*args, **kwargs),

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/django/django/template/loader.py", line 176, in render_to_string
   return t.render(context_instance)

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/jingo/jingo/__init__.py", line 189, in render
   return super(Template, self).render(context_dict)

 File "/usr/lib/python2.6/site-packages/jinja2/environment.py", line 891, in render
   return self.environment.handle_exception(exc_info, True)

 File "/data/www/mozillians-dev.allizom.org/mozillians/apps/phonebook/templates/phonebook/search.html", line 1, in top-level template code
   {% extends "base.html" %}

 File "/data/www/mozillians-dev.allizom.org/mozillians/templates/base.html", line 109, in top-level template code
   {% block main_content %}{% endblock %}

 File "/data/www/mozillians-dev.allizom.org/mozillians/apps/phonebook/templates/phonebook/search.html", line 53, in block "main_content"
   {{ search_result(person) }}

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/jingo/jingo/__init__.py", line 153, in wrapper
   t = env.get_template(template).render(context)

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/jingo/jingo/__init__.py", line 189, in render
   return super(Template, self).render(context_dict)

 File "/usr/lib/python2.6/site-packages/jinja2/environment.py", line 891, in render
   return self.environment.handle_exception(exc_info, True)

 File "/data/www/mozillians-dev.allizom.org/mozillians/apps/phonebook/templates/phonebook/includes/search_result.html", line 7, in top-level template code
   <h2><a href="{{ url('profile', profile.user.username) }}">

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/funfactory/funfactory/helpers.py", line 32, in url
   return reverse(viewname, args=args, kwargs=kwargs)

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/funfactory/funfactory/urlresolvers.py", line 28, in reverse
   url = django_reverse(viewname, urlconf, args, kwargs, prefix)

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/django/django/core/urlresolvers.py", line 452, in reverse
   *args, **kwargs)))

 File "/data/www/mozillians-dev.allizom.org/mozillians/vendor/src/django/django/core/urlresolvers.py", line 379, in reverse
   "arguments '%s' not found." % (lookup_view_s, args, kwargs))

NoReverseMatch: Reverse for 'profile' with arguments '(u'Sxxxxx.Axxx',)' and keyword arguments '{}' not found.
(Assignee)

Comment 2

6 years ago
This is to do with usernames in Django being "Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.", but our URLconf only checking for letters and dashes. We should follow Django's lead, because periods, underscores, and numbers in nicks are totally reasonable.

The actual user causing the error has the username "Sheikh.Aman".
Assignee: nobody → tofumatt
(Assignee)

Comment 3

6 years ago
https://github.com/mozilla/mozillians/pull/159 in review.

Comment 4

6 years ago
Commits pushed to master at https://github.com/mozilla/mozillians

https://github.com/mozilla/mozillians/commit/137ed32c39c1cc5a64904803b07531d06aa94da4
Use Django's username rules (fix bug 733408)

Allow some more flexible characters in Django username/URLs.

https://github.com/mozilla/mozillians/commit/ba140859532af9f9c9f1999764993ea1177ae708
Merge pull request #159 from tofumatt/fix-username-urls

Use Django's username rules (fix bug 733408)

Updated

6 years ago
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
(Reporter)

Comment 5

6 years ago
verified; it works like a charm!
Status: RESOLVED → VERIFIED

Updated

6 years ago
Component: mozillians.org → Phonebook
Product: Websites → Community Tools
QA Contact: mozillians-org → phonebook
Target Milestone: 1.3 → ---
Version: unspecified → other
You need to log in before you can comment on or make changes to this bug.