Permalink
Browse files

Merge pull request #12 from cglace/master

Python3 and Django 1.7 support
  • Loading branch information...
2 parents cfb9496 + 3e979cf commit 7e34ee16e10d9c63d4e1091009597bd39658d8d5 @sametmax committed Jan 28, 2015
@@ -5,7 +5,7 @@
VERSION = __version__ = "0.6.4"
-from decorators import view, routing
-from utils import setting, load_config
-from models import get_object_or_none
+from .decorators import view, routing
+from .utils import setting, load_config
+from .models import get_object_or_none
@@ -12,7 +12,7 @@
from django.conf.urls import include, url as addurl
from django.shortcuts import render
-from utils import HttpResponseException
+from .utils import HttpResponseException
__all__ = ["view", "routing"]
@@ -123,9 +123,14 @@ def wrapper(request, *args, **kwargs):
if rendering and not isinstance(response, HttpResponse):
if rendering == 'json':
- return HttpResponse(json.dumps(response),
- mimetype="application/json",
- *decorator_args, **decorator_kwargs)
+ if django.VERSION[0] >= 1 and django.VERSION[1] >= 7:
+ return HttpResponse(json.dumps(response),
+ content_type="application/json",
+ *decorator_args, **decorator_kwargs)
+ else:
+ return HttpResponse(json.dumps(response),
+ mimetype="application/json",
+ *decorator_args, **decorator_kwargs)
if rendering == 'raw':
return HttpResponse(response,
*decorator_args, **decorator_kwargs)
@@ -35,4 +35,4 @@ def handle(self, *args, **options):
return
Session.objects.all().delete()
- print '%s sessions deleted' % total
+ print('%s sessions deleted' % total)
@@ -12,9 +12,9 @@
from django.contrib.auth.models import User
-from namegen.namegen import NameGenerator
+from .namegen.namegen import NameGenerator
-from utils import setting
+from .utils import setting
class ForceSuperUserMiddleWare(object):

0 comments on commit 7e34ee1

Please sign in to comment.