1309: DashBoard: Using spaces for reviewers break review records

zoran******@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Sept. 22, 2009
What version are you running?
ReviewBoard 1.0.1

What's the URL of the page containing the problem?
[ sorry, not accessible, it's behind the company firewall ]

What steps will reproduce the problem?
1. Publish review, add 2 reviewers
2. Edit reviewers -- remove first, but leave a space char before second
3. Click OK
>> Result: everything appears to be fine, page rendered correctly; however,
hitting the refresh on the browser produces TemplateSyntaxError


What is the expected output? What do you see instead?

The Dashboard for this review ID should render correctly.

However, accessing the review ID (i.e. http://company.com/r/123/) will
always produces the following exception:
| TemplateSyntaxError at /r/123/
| Caught an exception while rendering: Reverse for 'reviewboard.user' with
arguments '(<User:  zoran.rajic>,)' and keyword arguments '{}' not found.


.. furthermore, a brand new username seems to be inserted into the
reviewboard's database (note the ' '-char in front of the e-mail:

mysql> select * from auth_user where id=67 \G;
*************************** 1. row ***************************
          id: 67
    username:  zoran.rajic
  first_name: Zoran
   last_name: Rajic
       email:  zoran.rajic@company.com
    password: !
    is_staff: 0
   is_active: 1
is_superuser: 0
  last_login: 2009-09-11 13:52:21
 date_joined: 2009-09-11 13:52:21
1 row in set (0.01 sec)

The new username is also reflected in the list of users - so one ends up
with "username" and " username" in the list.


What operating system are you using? What browser?

ReviewBoard 1.0.1 running on OpenSuse v11.1 64bit Linux, Python v2.6.0,
Apache v2.2.10, MySQL v5.0.67

Reproduced with Firefox 3.5 (Windows and Linux), also MS Internet Exploder 7


Please provide any additional information below.

Exception stack-trace:

Exception Type: TemplateSyntaxError 
Exception Value: Caught an exception while rendering: Reverse for
'reviewboard.user' with arguments '(<User:  zoran.rajic>,)' and keyword
arguments '{}' not found. 

Template error
In template
/usr/local/lib64/python2.6/site-packages/ReviewBoard-1.0.1-py2.6.egg/reviewboard/templates/reviews/review_request_box.html,
error at line 49

Caught an exception while rendering: Reverse for 'reviewboard.user' with
arguments '(<User: zoran.rajic>,)' and keyword arguments '{}' not found.
39    <td class="label"><label for="bugs_closed">{% trans "Bugs"
%}:</label></td>
40    <td class="value"><span id="bugs_closed" class="editable
comma-editable">{% spaceless %}
41 {%  for bug in review_request_details.get_bug_list %}
42 {%   with bug|bug_url:review_request as bug_url %}
43 {%    if bug_url %}<a href="{{bug_url}}">{{bug}}</a>{% else %}{{bug}}{%
endif %}{% if not forloop.last %}, {% endif %}
44 {%   endwith %}
45 {%  endfor %}
46 {% endspaceless %}</span></td>
47    <td class="indented label"><label for="target_people">{% trans
"People" %}:</label></td>
48    <td class="value"><span id="target_people" class="editable
comma-editable">{% spaceless %}
49 {%  for person in review_request_details.target_people.all %}
50 <a href="{% url user person %}"{% if not person.is_active %}
class="inactive"{% endif %}>{{person}}</a>{% if not forloop.last %}, {%
endif %}
51 {%  endfor %}
52 {% endspaceless %}</span></td>
53   </tr>
54   <tr>
55    <td class="label"><label for="changenum">{% trans "Change Number"
%}:</label></td>
56    <td class="value"><span
id="changenum">{{review_request.changenum}}</span></td>
57    <td class="label"><label for="repository">{% trans "Repository"
%}:</label></td>
58    <td class="value"><span
id="repository">{{review_request.repository}}</span></td>
59   </tr>
chipx86
#1 chipx86
  • +Confirmed
  • +Milestone-Release1.0.x
    +Component-Reviews
chipx86
#2 chipx86
What authentication mechanism are you using?

The core issue is that we're attempting to look up the user and we find it in the
backend, but we're not finding a User object that matches, so we create one, with the
space in the filename.
  • -Confirmed
    +NeedInfo
  • -Component-Reviews
    +Component-Accounts
#3 zoran******@gmai***** (Google Code) (Is this you? Claim this profile.)
Hello chipx86,

I'm using the LDAP server for the authentication.  If I may suggest, it's generally 
highly irregular to have the usernames prefixed with ' ' (space) characters, on 
pretty much anything (UX/Win accounts, DBs, Wikis...) so perhaps we could trim the 
leading whitespaces on the input?

BTW (perhaps people can use this as a workaround): if one removes the offending 
usernames from the ReviewBoard, the TemplateSyntaxError goes away and review ID's 
dashboard renders OK again.
What one needs to do, is use use http://company.com/admin/db/auth/user/ as admin, 
sort by Username, and remove users that pop up on the top, which seem to be outside 
of the alphabetical order (note that the space-char leading usernames will be on the 
top, but it's not very obvious with the HTML rendering, so they'll appear as outside 
of "sorting order").

Thanks,
	Zoran
chipx86
#4 chipx86
Fixed in r81c2ae9.
  • -NeedInfo
    +Fixed
  • +chipx86