Browse Source

update embedded djExtDirect to 0.9

Natenom/support-murmur-13-1446181288462
Michael Ziegler 11 years ago
parent
commit
1d13681f65
  1. 2
      pyweb/djextdirect/__init__.py
  2. 2
      pyweb/djextdirect/formprovider.py
  3. 10
      pyweb/djextdirect/provider.py

2
pyweb/djextdirect/__init__.py

@ -15,7 +15,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
""" """
VERSION = ( 0, 8 )
VERSION = ( 0, 9 )
VERSIONSTR = "v%d.%d" % VERSION VERSIONSTR = "v%d.%d" % VERSION

2
pyweb/djextdirect/formprovider.py

@ -21,7 +21,7 @@ import functools
from django import forms from django import forms
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from django.conf.urls.defaults import url
from django.conf.urls import url
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder

10
pyweb/djextdirect/provider.py

@ -23,7 +23,7 @@ from sys import stderr
from django.http import HttpResponse from django.http import HttpResponse
from django.conf import settings from django.conf import settings
from django.conf.urls.defaults import patterns
from django.conf.urls import patterns
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.datastructures import MultiValueDictKeyError from django.utils.datastructures import MultiValueDictKeyError
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder
@ -163,10 +163,10 @@ class Provider( object ):
found) and encoding the response / exceptions. found) and encoding the response / exceptions.
""" """
request.META["CSRF_COOKIE_USED"] = True request.META["CSRF_COOKIE_USED"] = True
# First try to use request.POST, if that doesn't work check for req.raw_post_data.
# First try to use request.POST, if that doesn't work check for req.body.
# The other way round this might make more sense because the case that uses # The other way round this might make more sense because the case that uses
# raw_post_data is way more common, but accessing request.POST after raw_post_data
# causes issues with Django's test client while accessing raw_post_data after
# body is way more common, but accessing request.POST after body
# causes issues with Django's test client while accessing body after
# request.POST does not. # request.POST does not.
try: try:
jsoninfo = { jsoninfo = {
@ -178,7 +178,7 @@ class Provider( object ):
} }
except (MultiValueDictKeyError, KeyError), err: except (MultiValueDictKeyError, KeyError), err:
try: try:
rawjson = json.loads( request.raw_post_data )
rawjson = json.loads( request.body )
except getattr( json, "JSONDecodeError", ValueError ): except getattr( json, "JSONDecodeError", ValueError ):
return HttpResponse( json.dumps({ return HttpResponse( json.dumps({
'type': 'exception', 'type': 'exception',

Loading…
Cancel
Save