open-humans
open-humans copied to clipboard
Unicode error in page URL
Site produces an error rather than 404 when a URL containing unicode is attempted. URLs are converted into identifiers for CSS purposes, and this seems to be the source of the error.
(Low priority, since it only occurs when individuals -- possibly bots -- are trying incorrect URLs.)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)
(17 additional frame(s) were not displayed)
...
File "open_humans/views.py", line 434, in server_error
response = render(request, '500.html')
File "open_humans/templatetags/utilities.py", line 192, in page_body_id
return 'page-{}'.format(path)
What happens when project names include unicode characters? For TwArχiv I tried changing the name on OH to 'TwArχiv' but as it lead to strange URLs I chose to stick to the twitter-archive-analyzer
. Just wonder whether this could lead to problems.
@gedankenstuecke re: "TwArχiv" I think the culprit is the AutoSlugField
; one fix would be to pass in your own slugify
method that didn't mangle the URL
In [1]: from autoslug.settings import slugify
In [2]: slugify('TwArχiv')
Out[2]: u'twariv'