Giter VIP home page Giter VIP logo

django-simple-rest's Issues

Add common media type handlers for HTTP POSTs

In the latest update to Django (v1.5) a change was made to make the processing of data sent via an HTTP POST more strict. A full explanation of the change and its impact upon this framework can be seen in Issue #6, but as a short explanation, the problem is when the Content-type of the POST is either missing, or is something other than file upload or form post data.

In cases where the Content-type header is not one of the aforementioned types, the data for the POST is not processed and placed into the POST QueryDict, but instead left in the raw_post_data field of the request object and left up to the user to parse into useable data. This issue deals with the addition of a simple mechanism whereby classes for parsing different data Content-types can be plugged into the framework to allow Content-types other than file upload and form post data to be parsed into the POST QueryDict.

Use of request.REQUEST is deprecated in Django 1.9

When using django-simple-rest resources under Django 1.8, I'm observing the following warning:

lib\site-packages\simple_rest\response.py:105: RemovedInDjango19Warning: request.REQUEST is deprecated, use request.GET or request.POST instead.
format = request.REQUEST.get('_format', None) or format

Typo in README

INSTALLED_APPS += ['simple-rest'] should be
INSTALLED_APPS += ['simple_rest']

JSON serialization does not work with Django 1.5 and simplejson

Seems to work fine without simplejson, but today I had to add another package that has a hard dependency on simplejson, so now django-simple-rest stopped working. The trackeback is:

Traceback (most recent call last):
  File "/.../Django-1.5.1-py2.7.egg/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/.../Django-1.5.1-py2.7.egg/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/.../Django-1.5.1-py2.7.egg/django/views/decorators/csrf.py", line 77, in wrapped_view
    return view_func(*args, **kwargs)
  File "/.../django_simple_rest-1.4.1-py2.7.egg/simple_rest/resource.py", line 44, in dispatch
    response = super(Resource, self).dispatch(request, *args, **kwargs)
  File "/.../Django-1.5.1-py2.7.egg/django/views/generic/base.py", line 86, in dispatch
    return handler(request, *args, **kwargs)
  File "/.../Django-1.5.1-py2.7.egg/django/utils/decorators.py", line 25, in _wrapper
    return bound_func(*args, **kwargs)
  File "/.../django_simple_rest-1.4.1-py2.7.egg/simple_rest/response.py", line 99, in wrapper
    response = self.render_to_response(request, data, status_code, kwargs.get('_format', None))
  File "/.../django_simple_rest-1.4.1-py2.7.egg/simple_rest/response.py", line 121, in render_to_response
    response = HttpResponse(templ_or_func(data))
  File "/.../django_simple_rest-1.4.1-py2.7.egg/simple_rest/utils/serializers.py", line 37, in to_json
    serialized_content = json.dumps(content, cls=DjangoJSONEncoder, ensure_ascii=False, indent=indent)
  File "/.../simplejson-2.6.2-py2.7-macosx-10.8-intel.egg/simplejson/__init__.py", line 334, in dumps
    **kw).encode(obj)
TypeError: __init__() got an unexpected keyword argument 'namedtuple_as_object'

The fix in 8b56e34 works, but it seems a bit inefficient/hacky, and it is not in the latest release (1.4.1).

Have you done any performance analytics on the simplejson version shipped with newerish python versions vs. simplejson? The reason I ask is that I am wondering if simplejson is worth the extra complexity/hacks, or if it might be better to follow Django 1.5, and simply use the built-in json-module?

Thanks for creating this brilliant peace of software.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.