Issue 78 in django-jython: django html.py fix for jython - where to put?

6 views
Skip to first unread message

django...@googlecode.com

unread,
Oct 7, 2012, 8:23:18 AM10/7/12
to django-j...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 78 by stefan.h...@gmail.com: django html.py fix for jython -
where to put?
http://code.google.com/p/django-jython/issues/detail?id=78

I had to fix django's html.py to get it work with jython. I am not sure, if
this fix therefore should go on django or better django-jython project.


Following code I had to fix:

==========================
django, fix for jython
==========================
Lib/site-packages/django/utils/html.py
# sorry, forget to save original to make diff...

#jython fix, requires java6 / took from jython socket.py
_encode_idna = None
import sys
if sys.platform.startswith('java'):
# Attempt to provide IDNA (RFC 3490) support.
#
# Try java.net.IDN, built into java 6
#
import java.lang
idna_libraries = [
('java.net.IDN', 'toASCII', java.lang.IllegalArgumentException)
]
for idna_lib, idna_fn_name, exc in idna_libraries:
try:
m = __import__(idna_lib, globals(), locals(), [idna_fn_name])
idna_fn = getattr(m, idna_fn_name)
def _encode_idna(name):
try:
return idna_fn(name)
except exc:
raise UnicodeEncodeError(name)
break
except (AttributeError, ImportError), e:
pass
else:
_encode_idna = lambda x: x.encode("ascii")


def smart_urlquote(url):
....
if _encode_idna: # jython fix, see above
netloc = _encode_idna(netloc)
else:
netloc = netloc.encode('idna') # IDN -> ACE

django...@googlecode.com

unread,
Oct 7, 2012, 10:21:59 AM10/7/12
to django-j...@googlegroups.com
Updates:
Status: Started
Owner: juneau001

Comment #1 on issue 78 by juneau001: django html.py fix for jython - where
to put?
http://code.google.com/p/django-jython/issues/detail?id=78

Thanks for the patch. I will apply the fix to the codebase and test. This
is the appropriate project for patching, not Jython proper. Your work is
appreciated.

django...@googlecode.com

unread,
Aug 10, 2014, 4:32:29 AM8/10/14
to django-j...@googlegroups.com
Updates:
Status: Invalid

Comment #2 on issue 78 by andr...@st0cker.at: django html.py fix for jython
(No comment was entered for this change.)

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages