django-mongonaut icon indicating copy to clipboard operation
django-mongonaut copied to clipboard

UnicodeEncodeError in mongonaut_tags

Open lchsk opened this issue 9 years ago • 3 comments

In mongonaut_tags.py there are two similar lines:

(1) return mark_safe("""<a href="{0}">{1}</a>""".format(value, value)) (2) return mark_safe("""<a href="{0}">{1}</a>""".format(url, value.__unicode__()))

Is there a reason for using .__unicode__() in (2)? (It gives me me UnicodeEncodeError on a string that includes unicode characters. Removing .__unicode__() seems to help.)

Cheers

lchsk avatar Jun 30 '15 23:06 lchsk

I'm not entirely sure at the moment if there is a technical reason they are different.

this was the newer of the two: https://github.com/pydanny/django-mongonaut/commit/0a7320269064fc4a1602987e6f320fb72b34046e

garrypolley avatar Jul 08 '15 15:07 garrypolley

Assuming it doesn't break anything I'm cool with a change to not call .__unicode__

garrypolley avatar Jul 09 '15 20:07 garrypolley

I removed .__unicode__ in my local version for the project I'm currently developing. It did not break anything for what I can observe. I can prepare a pull request later.

lchsk avatar Jul 10 '15 17:07 lchsk