Skip to content

Instantly share code, notes, and snippets.

@tkusano
Last active August 29, 2015 13:56
Show Gist options
  • Save tkusano/9226324 to your computer and use it in GitHub Desktop.
Save tkusano/9226324 to your computer and use it in GitHub Desktop.
python3 patch for django-dajaxice-0.5.6.5
diff -uNr django-dajaxice-ng-0.5.6.5.orig/core/__init__.py django-dajaxice-ng-0.5.6.5/core/__init__.py
--- django-dajaxice-ng-0.5.6.5.orig/core/__init__.py 2014-01-19 18:17:40.000000000 +0900
+++ django-dajaxice-ng-0.5.6.5/core/__init__.py 2014-02-26 15:17:16.122867309 +0900
@@ -1,6 +1,6 @@
from django.conf import settings
-from Dajaxice import Dajaxice, dajaxice_autodiscover
+from .Dajaxice import Dajaxice, dajaxice_autodiscover
class DajaxiceConfig(object):
diff -uNr django-dajaxice-ng-0.5.6.5.orig/utils.py django-dajaxice-ng-0.5.6.5/utils.py
--- django-dajaxice-ng-0.5.6.5.orig/utils.py 2013-11-19 13:22:51.000000000 +0900
+++ django-dajaxice-ng-0.5.6.5/utils.py 2014-02-26 17:22:16.654886903 +0900
@@ -5,4 +5,4 @@
"""
Create a new QueryDict from a serialized form.
"""
- return QueryDict(query_string=unicode(data).encode('utf-8'))
+ return QueryDict(query_string=str(data).encode('utf-8'))
diff -uNr django-dajaxice-ng-0.5.6.5.orig/views.py django-dajaxice-ng-0.5.6.5/views.py
--- django-dajaxice-ng-0.5.6.5.orig/views.py 2014-01-19 18:13:42.000000000 +0900
+++ django-dajaxice-ng-0.5.6.5/views.py 2014-02-26 18:13:46.658894975 +0900
@@ -13,19 +13,6 @@
log = logging.getLogger('dajaxice')
-def safe_dict(d):
- """
- Recursively clone json structure with UTF-8 dictionary keys
- http://www.gossamer-threads.com/lists/python/bugs/684379
- """
- if isinstance(d, dict):
- return dict([(k.encode('utf-8'), safe_dict(v)) for k, v in d.iteritems()])
- elif isinstance(d, list):
- return [safe_dict(x) for x in d]
- else:
- return d
-
-
class DajaxiceRequest(View):
""" Handle all the dajaxice xhr requests. """
@@ -42,10 +29,7 @@
# Clean the argv
if data != 'undefined':
- try:
- data = safe_dict(json.loads(data))
- except Exception:
- data = {}
+ data = json.loads(data)
else:
data = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment