summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mirrors/views.py5
-rw-r--r--packages/views/__init__.py10
-rw-r--r--packages/views/search.py5
-rw-r--r--packages/views/signoff.py7
-rw-r--r--todolists/views.py6
-rw-r--r--visualize/views.py8
6 files changed, 18 insertions, 23 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index eac78ff2..b0be6238 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -1,5 +1,6 @@
from datetime import timedelta
from itertools import groupby
+import json
from operator import attrgetter, itemgetter
from django import forms
@@ -10,7 +11,6 @@ from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.simple import direct_to_template
-from django.utils import simplejson
from django_countries.countries import COUNTRIES
from .models import Mirror, MirrorUrl, MirrorProtocol
@@ -237,8 +237,7 @@ def status_json(request):
status_info = get_mirror_statuses()
data = status_info.copy()
data['version'] = 3
- to_json = simplejson.dumps(data, ensure_ascii=False,
- cls=MirrorStatusJSONEncoder)
+ to_json = json.dumps(data, ensure_ascii=False, cls=MirrorStatusJSONEncoder)
response = HttpResponse(to_json, mimetype='application/json')
return response
diff --git a/packages/views/__init__.py b/packages/views/__init__.py
index 60c3a46b..c1a035d0 100644
--- a/packages/views/__init__.py
+++ b/packages/views/__init__.py
@@ -1,4 +1,5 @@
import hashlib
+import json
from string import Template
from urllib import urlencode
@@ -8,7 +9,6 @@ from django.contrib.auth.models import User
from django.core.cache import cache
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404, redirect
-from django.utils import simplejson
from django.views.decorators.cache import cache_control
from django.views.decorators.http import require_GET, require_POST
from django.views.decorators.vary import vary_on_headers
@@ -55,7 +55,7 @@ def opensearch_suggest(request):
pkgname__startswith=search_term).values_list(
'pkgname', flat=True).order_by('pkgname').distinct()[:10]
results = [search_term, list(names)]
- to_json = simplejson.dumps(results, ensure_ascii=False)
+ to_json = json.dumps(results, ensure_ascii=False)
cache.set(cache_key, to_json, 300)
return HttpResponse(to_json, mimetype='application/x-suggestions+json')
@@ -197,8 +197,7 @@ def files(request, name, repo, arch):
def details_json(request, name, repo, arch):
pkg = get_object_or_404(Package,
pkgname=name, repo__name__iexact=repo, arch__name=arch)
- to_json = simplejson.dumps(pkg, ensure_ascii=False,
- cls=PackageJSONEncoder)
+ to_json = json.dumps(pkg, ensure_ascii=False, cls=PackageJSONEncoder)
return HttpResponse(to_json, mimetype='application/json')
def files_json(request, name, repo, arch):
@@ -212,8 +211,7 @@ def files_json(request, name, repo, arch):
'arch': pkg.arch.name.lower(),
'files': fileslist,
}
- to_json = simplejson.dumps(data, ensure_ascii=False,
- cls=PackageJSONEncoder)
+ to_json = json.dumps(data, ensure_ascii=False, cls=PackageJSONEncoder)
return HttpResponse(to_json, mimetype='application/json')
def download(request, name, repo, arch):
diff --git a/packages/views/search.py b/packages/views/search.py
index a09de0a7..a89822be 100644
--- a/packages/views/search.py
+++ b/packages/views/search.py
@@ -1,4 +1,5 @@
from datetime import datetime
+import json
from django import forms
from django.contrib.admin.widgets import AdminDateWidget
@@ -6,7 +7,6 @@ from django.contrib.auth.models import User
from django.db.models import Q
from django.http import HttpResponse
from django.views.generic import list_detail
-from django.utils import simplejson
from main.models import Package, Arch, Repo
from main.utils import make_choice
@@ -179,8 +179,7 @@ def search_json(request):
container['results'] = packages
container['valid'] = True
- to_json = simplejson.dumps(container, ensure_ascii=False,
- cls=PackageJSONEncoder)
+ to_json = json.dumps(container, ensure_ascii=False, cls=PackageJSONEncoder)
return HttpResponse(to_json, mimetype='application/json')
# vim: set ts=4 sw=4 et:
diff --git a/packages/views/signoff.py b/packages/views/signoff.py
index 63341a1d..61d949fc 100644
--- a/packages/views/signoff.py
+++ b/packages/views/signoff.py
@@ -1,3 +1,4 @@
+import json
from operator import attrgetter
from django import forms
@@ -7,7 +8,6 @@ from django.core.serializers.json import DjangoJSONEncoder
from django.db import transaction
from django.http import HttpResponse, Http404
from django.shortcuts import get_list_or_404, redirect, render
-from django.utils import simplejson
from django.views.decorators.cache import never_cache
from django.views.generic.simple import direct_to_template
@@ -67,7 +67,7 @@ def signoff_package(request, name, repo, arch, revoke=False):
'known_bad': spec.known_bad,
'user': str(request.user),
}
- return HttpResponse(simplejson.dumps(data, ensure_ascii=False),
+ return HttpResponse(json.dumps(data, ensure_ascii=False),
mimetype='application/json')
return redirect('package-signoffs')
@@ -183,8 +183,7 @@ def signoffs_json(request):
'version': 2,
'signoff_groups': signoff_groups,
}
- to_json = simplejson.dumps(data, ensure_ascii=False,
- cls=SignoffJSONEncoder)
+ to_json = json.dumps(data, ensure_ascii=False, cls=SignoffJSONEncoder)
response = HttpResponse(to_json, mimetype='application/json')
return response
diff --git a/todolists/views.py b/todolists/views.py
index 70209b6d..b9ba0903 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -1,5 +1,6 @@
-from django import forms
+import json
+from django import forms
from django.http import HttpResponse
from django.core.mail import send_mail
from django.shortcuts import get_list_or_404, get_object_or_404, redirect
@@ -9,7 +10,6 @@ from django.views.decorators.cache import never_cache
from django.views.generic import DeleteView
from django.views.generic.simple import direct_to_template
from django.template import Context, loader
-from django.utils import simplejson
from main.models import Todolist, TodolistPkg, Package, Repo
from packages.utils import attach_maintainers
@@ -42,7 +42,7 @@ def flag(request, list_id, pkg_id):
pkg.save()
if request.is_ajax():
return HttpResponse(
- simplejson.dumps({'complete': pkg.complete}),
+ json.dumps({'complete': pkg.complete}),
mimetype='application/json')
return redirect(todolist)
diff --git a/visualize/views.py b/visualize/views.py
index afc5429d..95f8c314 100644
--- a/visualize/views.py
+++ b/visualize/views.py
@@ -1,9 +1,9 @@
from datetime import datetime
+import json
from django.contrib.auth.models import User
from django.db.models import Count, Sum, Q
from django.http import HttpResponse
-from django.utils import simplejson
from django.views.decorators.cache import cache_page
from django.views.generic.simple import direct_to_template
@@ -61,13 +61,13 @@ def arch_repo_data():
@cache_page(1800)
def by_arch(request):
data = arch_repo_data()
- to_json = simplejson.dumps(data['by_arch'], ensure_ascii=False)
+ to_json = json.dumps(data['by_arch'], ensure_ascii=False)
return HttpResponse(to_json, mimetype='application/json')
@cache_page(1800)
def by_repo(request):
data = arch_repo_data()
- to_json = simplejson.dumps(data['by_repo'], ensure_ascii=False)
+ to_json = json.dumps(data['by_repo'], ensure_ascii=False)
return HttpResponse(to_json, mimetype='application/json')
@@ -109,7 +109,7 @@ def pgp_keys(request):
data = { 'nodes': node_list, 'edges': edge_list }
- to_json = simplejson.dumps(data, ensure_ascii=False)
+ to_json = json.dumps(data, ensure_ascii=False)
return HttpResponse(to_json, mimetype='application/json')
# vim: set ts=4 sw=4 et: