mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 00:38:11 -05:00
Remove underused json_respond
This should help resolve a circular import wherein "import jsonresponse" triggers "from r2.lib.pages.things import wrap_links" in jsonresponse.py, which triggers "from pages import *" in r2/lib/pages/__init__.py, which further triggers "from r2.lib.jsonresponse import json_respond" in pages.py
This commit is contained in:
@@ -30,7 +30,7 @@ from r2.lib.filters import markdown_souptest
|
||||
from r2.lib.db import tdb_cassandra
|
||||
from r2.lib.db.operators import asc, desc
|
||||
from r2.lib.template_helpers import add_sr
|
||||
from r2.lib.jsonresponse import json_respond, JQueryResponse, JsonResponse
|
||||
from r2.lib.jsonresponse import JQueryResponse, JsonResponse
|
||||
from r2.lib.log import log_text
|
||||
from r2.models import *
|
||||
from r2.lib.authorize import Address, CreditCard
|
||||
|
||||
@@ -32,12 +32,6 @@ from r2.models import IDBuilder, Listing
|
||||
import simplejson
|
||||
from pylons import c, g
|
||||
|
||||
def json_respond(x):
|
||||
if g.debug:
|
||||
return websafe_json(simplejson.dumps(x or '',
|
||||
sort_keys=True, indent=4))
|
||||
else:
|
||||
return websafe_json(simplejson.dumps(x or ''))
|
||||
|
||||
class JsonResponse(object):
|
||||
"""
|
||||
|
||||
@@ -35,7 +35,6 @@ from r2.models import Thing
|
||||
from r2.config import cache
|
||||
from r2.config.extensions import is_api
|
||||
from r2.lib.menus import CommentSortMenu
|
||||
from r2.lib.jsonresponse import json_respond
|
||||
from pylons.i18n import _, ungettext
|
||||
from pylons import c, request, g
|
||||
from pylons.controllers.util import abort
|
||||
@@ -89,7 +88,7 @@ def responsive(res, space_compress = False):
|
||||
controller so that it becomes compatible with the page cache.
|
||||
"""
|
||||
if is_api():
|
||||
res = json_respond(res)
|
||||
res = websafe_json(simplejson.dumps(res or ''))
|
||||
if c.allowed_callback:
|
||||
res = "%s(%s)" % (websafe_json(c.allowed_callback), res)
|
||||
elif space_compress:
|
||||
|
||||
Reference in New Issue
Block a user