File: compat.py

package info (click to toggle)
graphite-web 1.1.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,592 kB
  • sloc: javascript: 86,823; python: 11,977; sh: 61; makefile: 50
file content (19 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

from django import VERSION
from django.http import (HttpResponse as BaseHttpResponse,
                         HttpResponseBadRequest as Base400)


class ContentTypeMixin(object):
    def __init__(self, *args, **kwargs):
        if VERSION < (1, 5) and 'content_type' in kwargs:
            kwargs['mimetype'] = kwargs.pop('content_type')
        super(ContentTypeMixin, self).__init__(*args, **kwargs)


class HttpResponse(ContentTypeMixin, BaseHttpResponse):
    pass


class HttpResponseBadRequest(ContentTypeMixin, Base400):
    pass