|
@ -15,11 +15,7 @@ |
|
|
* GNU General Public License for more details. |
|
|
* GNU General Public License for more details. |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
import simplejson |
|
|
|
|
|
except ImportError: |
|
|
|
|
|
import json as simplejson |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import json |
|
|
import httplib |
|
|
import httplib |
|
|
from threading import Lock |
|
|
from threading import Lock |
|
|
from urlparse import urljoin, urlparse |
|
|
from urlparse import urljoin, urlparse |
|
@ -49,7 +45,7 @@ def lexjs(javascript): |
|
|
elif state == ST_ASSIGN: |
|
|
elif state == ST_ASSIGN: |
|
|
if char == ';': |
|
|
if char == ';': |
|
|
state = ST_NAME |
|
|
state = ST_NAME |
|
|
foundvars[name] = simplejson.loads(buf) |
|
|
|
|
|
|
|
|
foundvars[name] = json.loads(buf) |
|
|
name = "" |
|
|
name = "" |
|
|
buf = "" |
|
|
buf = "" |
|
|
else: |
|
|
else: |
|
@ -135,7 +131,7 @@ class Client(object): |
|
|
def call( self, action, method, *args ): |
|
|
def call( self, action, method, *args ): |
|
|
""" Make a call to Ext.Direct. """ |
|
|
""" Make a call to Ext.Direct. """ |
|
|
reqtid = self.tid |
|
|
reqtid = self.tid |
|
|
data=simplejson.dumps({ |
|
|
|
|
|
|
|
|
data=json.dumps({ |
|
|
'tid': reqtid, |
|
|
'tid': reqtid, |
|
|
'action': action, |
|
|
'action': action, |
|
|
'method': method, |
|
|
'method': method, |
|
@ -160,7 +156,7 @@ class Client(object): |
|
|
if resp.status != 200: |
|
|
if resp.status != 200: |
|
|
raise RequestError( resp.status, resp.reason ) |
|
|
raise RequestError( resp.status, resp.reason ) |
|
|
|
|
|
|
|
|
respdata = simplejson.loads( resp.read() ) |
|
|
|
|
|
|
|
|
respdata = json.loads( resp.read() ) |
|
|
if respdata['type'] == 'exception': |
|
|
if respdata['type'] == 'exception': |
|
|
raise ReturnedError( respdata['message'], respdata['where'] ) |
|
|
raise ReturnedError( respdata['message'], respdata['where'] ) |
|
|
if respdata['tid'] != reqtid: |
|
|
if respdata['tid'] != reqtid: |
|
|