Closed
Bug 728276
Opened 13 years ago
Closed 13 years ago
[traceback] NoReverseMatch while rendering: Reverse for 'profiles_edit' with arguments '(u'*&$*#(&$#()',)' and keyword arguments '{}' not found.
Categories
(Mozilla Reps Graveyard :: reps.mozilla.org, task)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: stephend, Assigned: giorgos)
Details
Attachments
(1 file)
424.31 KB,
image/png
|
Details |
I tried to update my username with "*&$*#", etc. chars, and hit this traceback:
Traceback:
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/data/www/reps-dev.allizom.org/remo/remo/base/decorators.py" in wrapper
54. return func(request, *args, **kwargs)
File "/data/www/reps-dev.allizom.org/remo/remo/profiles/views.py" in edit
78. 'range_years': range(1950, datetime.today().year - 11)})
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/shortcuts/__init__.py" in render
44. return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/loader.py" in render_to_string
188. return t.render(context_instance)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/base.py" in render
123. return self._render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/debug.py" in render_node
73. result = node.render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/loader_tags.py" in render
127. return compiled_parent._render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/base.py" in _render
117. return self.nodelist.render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/debug.py" in render_node
73. result = node.render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/loader_tags.py" in render
64. result = block.nodelist.render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/base.py" in render
744. bits.append(self.render_node(node, context))
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/debug.py" in render_node
73. result = node.render(context)
File "/data/www/reps-dev.allizom.org/remo/vendor/src/django/django/template/defaulttags.py" in render
450. raise e
Exception Type: TemplateSyntaxError at /u/stephen_donner/edit/
Exception Value: Caught NoReverseMatch while rendering: Reverse for 'profiles_edit' with arguments '(u'*&$*#(&$#()',)' and keyword arguments '{}' not found.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → giorgos
Status: NEW → ASSIGNED
Comment 1•13 years ago
|
||
It looks like the problem is here: https://github.com/mozilla/remo/blob/master/remo/profiles/user_urls.py#L6
The URL regex only matches alpha-numeric and "_", but apparently the app allows a lot of other characters for the display_name. Either the display_name needs to be as restrictive as the URL, the URL component for profile URLs needs to be something else, or the URL needs to match the same validation as display_name.
Assignee | ||
Comment 2•13 years ago
|
||
Thanks for the help pmac.
Looking deeper into the problem, both URL regex and model validation match the exact same set of characters.
Look here https://github.com/mozilla/remo/blob/master/remo/profiles/models.py#L56
In fact the model validation works correctly, user get returned to the /edit/ page to re-edit bogus display_name which does not validate.
The problem starts here:
1. The profile_edit.html template uses the "pageuser" variable to populate form's post value.
https://github.com/mozilla/remo/blob/master/remo/profiles/templates/profiles_edit.html#L17
2. "pageuser" is the user object *directly* fetched from the database.
https://github.com/mozilla/remo/blob/master/remo/profiles/views.py#L29
3. Therefore pageuser.userprofile.display_name should have the old valid value for display_name and shouldn't cause an error. But this is not what happening...
Pageuser has the form values which where not saved into the db!
Do you have any clues why this happens? Did I miss something or is it a django bug / django intended behaviour?
Thnx!
Assignee | ||
Comment 3•13 years ago
|
||
It seems that profileform.is_valid(instance=user) alters instance, thus we need to refetch the object from the database.
Patch: https://github.com/mozilla/remo/pull/19
Assignee | ||
Updated•13 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 4•13 years ago
|
||
Updated•5 years ago
|
Product: Mozilla Reps → Mozilla Reps Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•