Browse Source

completely switch from simplejson to json

Natenom/support-murmur-13-1446181288462
Michael Ziegler 12 years ago
parent
commit
84701bfda7
  1. 11
      pyweb/mumble/tests.py
  2. 14
      pyweb/mumble/views.py

11
pyweb/mumble/tests.py

@ -57,10 +57,7 @@
# * Log messages: yes
# * Instance scope: ALL
try:
import simplejson
except ImportError:
import json as simplejson
import json
from django.conf import settings
from django.test import TestCase
@ -91,7 +88,7 @@ class ExtDirectFormTestMixin(object):
def formGet( self, data=[] ):
rawr = self.cl.post( self.api_baseurl+'/router',
data=simplejson.dumps({
data=json.dumps({
'tid': self.tid,
'action': ('XD_%s' % self.formname),
'method': 'get',
@ -100,7 +97,7 @@ class ExtDirectFormTestMixin(object):
}),
content_type='application/json' )
self.tid += 1
response = simplejson.loads(rawr.content)
response = json.loads(rawr.content)
if response['type'] == "exception":
raise Exception( response["message"] )
self.assert_( "result" in response )
@ -117,7 +114,7 @@ class ExtDirectFormTestMixin(object):
self.tid += 1
postdata.update( data )
rawr = self.cl.post( self.api_baseurl+'/router', data=postdata )
response = simplejson.loads(rawr.content)
response = json.loads(rawr.content)
if response['type'] == "exception":
raise Exception( response["message"] )
self.assert_( "result" in response )

14
pyweb/mumble/views.py

@ -15,11 +15,7 @@
* GNU General Public License for more details.
"""
try:
import simplejson
except ImportError:
import json as simplejson
import json
import re
from StringIO import StringIO
@ -192,7 +188,7 @@ def show( request, server ):
return render_to_response( 'mumble/mumble.html', {
'MumbleServer': srv,
'ServerDict': simplejson.dumps(serverinfo(request, server)),
'ServerDict': json.dumps(serverinfo(request, server)),
'RegForm': regformname,
'MumbleActive': True,
'MumbleAccount':user,
@ -529,7 +525,7 @@ def mmng_tree( request, server ):
prefix = ""
return HttpResponse(
prefix + "(" + simplejson.dumps( { 'channels': chanlist, 'users': userlist } ) + ")",
prefix + "(" + json.dumps( { 'channels': chanlist, 'users': userlist } ) + ")",
mimetype='text/javascript'
)
@ -558,7 +554,7 @@ def cvp_json( request, server ):
See <http://mumble.sourceforge.net/Channel_Viewer_Protocol>
"""
srv = get_object_or_404( Mumble, id=int(server) )
json = simplejson.dumps( srv.asDict( cvp_checkauth( request, srv ) ) )
json = json.dumps( srv.asDict( cvp_checkauth( request, srv ) ) )
if "callback" in request.GET:
validate_jsonp_callback(request.GET["callback"])
@ -602,6 +598,6 @@ def mumbleviewer_tree_json( request, server ):
prefix = ""
return HttpResponse(
prefix + "(" + simplejson.dumps( srv.asMvJson() ) + ")",
prefix + "(" + json.dumps( srv.asMvJson() ) + ")",
mimetype='text/javascript'
)
Loading…
Cancel
Save