Opened 10 years ago
Closed 9 years ago
#791 closed defect (fixed)
When I tried put comment Slovakian language I got
|Reported by:||vlado||Owned by:|
File '/srv/goblin/mediagoblin/local/lib/python2.7/site-packages/Paste-184.108.40.206-py2.7.egg/paste/exceptions/errormiddleware.py', line 144 in call
app_iter = self.application(environ, sr_checker)
File '/srv/goblin/mediagoblin/local/lib/python2.7/site-packages/Paste-220.127.116.11-py2.7.egg/paste/urlmap.py', line 203 in call
return app(environ, start_response)
File '/srv/goblin/mediagoblin/mediagoblin/app.py', line 259 in call
return self.call_backend(environ, start_response)
File '/srv/goblin/mediagoblin/mediagoblin/app.py', line 236 in call_backend
response = controller(request)
File '/srv/goblin/mediagoblin/mediagoblin/decorators.py', line 228 in wrapper
return controller(request, media=media, *args, kwargs)
File '/srv/goblin/mediagoblin/mediagoblin/decorators.py', line 52 in new_controller_func
return controller(request, *args, kwargs)
File '/srv/goblin/mediagoblin/mediagoblin/user_pages/views.py', line 168 in media_post_comment
File '/srv/goblin/mediagoblin/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/serve.py', line 530 in write
UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-3: ordinal not in range(128)
Change History (12)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
|Status:||new → review|
comment:3 by , 9 years ago
comment:4 by , 9 years ago
comment:5 by , 9 years ago
I'm currently unable to reproduce this error. Can someone provide some steps that I can follow which will produce this error on the latest mater?
comment:6 by , 9 years ago
Thanks to help from tryggvib what needs to be done to reproduce is:
1) Upload some media
2) Log out and log in with another user
3) Leave a comment with some non-ascii characters (e.g. "aábcdðeéfghiíjklmnoópqrstuúvwxyýzþæö")
4) Log out
5) Log back in with original user and try to mark new comment notification as read
This will cause an error.
comment:7 by , 9 years ago
|Status:||review → closed|
This is fixed as of https://gitorious.org/mediagoblin/mediagoblin/commit/09bed9a7328c806873405bd2ec5a5cf72930e89c, thanks tryggvib!
comment:8 by , 9 years ago
Sorry, but I think the patch is incorrect.
__str__ methods must return a
str object in Python 2, not
unicode. There is already a
__unicode__ method for that purpose.
See http://stackoverflow.com/questions/3627793/best-output-type-and-encoding-practices-for-repr-functions for more information about this.
Note: The patch works great in Python 3.
comment:9 by , 9 years ago
__unicode___ representation to Notification and MediaCommentMixin objects and modified
__repr___ to return
str objects. It's in the same branch as before.
Here's the commit: https://gitorious.org/mediagoblin/tryggvi-mediagoblin/commit/89bd816cff47ba6d37a20e58c3053380a0c368ea
Here's the branch: https://gitorious.org/mediagoblin/tryggvi-mediagoblin/source/89bd816cff47ba6d37a20e58c3053380a0c368ea
comment:10 by , 9 years ago
|Status:||closed → accepted|
Since berkerpeksag was right in the comment I provided a fix. The ticket should be reopened to show that the fix (to berkerpeksag's comment) has not been merged.
comment:11 by , 9 years ago
|Status:||accepted → review|
Moving fix to berkerpeksag's comment to review.
comment:12 by , 9 years ago
|Status:||review → closed|
Well, LGTM. Berker is the domain expert here also.
I think maybe this could be simplified... these functions are *almost* the same. it's not important enough to figure out how, and it's not too egregious of code duplication.
Merged and closed!
I finally got so irritated with this bug (because I also happen to run into it quite frequently, running an international site) that I fixed it.
Here ya go: