Created
May 13, 2013 04:24
-
-
Save moshez/5566146 to your computer and use it in GitHub Desktop.
Where logs are needed in txmob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/txmob/nidl/types.py b/txmob/nidl/types.py | |
index 86595f7..2fe1811 100644 | |
--- a/txmob/nidl/types.py | |
+++ b/txmob/nidl/types.py | |
@@ -190,6 +190,7 @@ class Implementation(object): | |
if '_user' in kwargs: | |
user = kwargs['_user'] | |
if user is not None: | |
+ print "woo got user", user | |
User.processInput(user) | |
del kwargs['_user'] | |
else: | |
diff --git a/txmob/protocol/rest.py b/txmob/protocol/rest.py | |
index f103c20..720de1c 100644 | |
--- a/txmob/protocol/rest.py | |
+++ b/txmob/protocol/rest.py | |
@@ -15,7 +15,9 @@ from txmob.nidl import control, client, types | |
def _getKwargs(request): | |
request.content.seek(0, 0) | |
- kwargs = json.loads(request.content.read()) | |
+ res = request.content.read() | |
+ print "got request input", res | |
+ kwargs = json.loads(res) | |
return kwargs | |
class NotFound(Exception): | |
@@ -28,7 +30,7 @@ def _handleResult(res, request): | |
request.finish() | |
res.addCallback(_sendResult) | |
def _userErrResult(err): | |
- exc = err.trap(NotFound, types.ArgumentMismatch) | |
+ exc = err.trap(NotFound)#, types.ArgumentMismatch) | |
if exc == types.ArgumentMismatch: | |
request.setResponseCode(400) | |
else: | |
@@ -68,6 +70,7 @@ class BasicResource(resource.Resource): | |
def _callMethod(_res): | |
method = request.postpath[0] | |
kwargs = _getKwargs(request) | |
+ print "got kwargs from request", kwargs | |
return self._callMethod(method, kwargs) | |
res.addCallback(_callMethod) | |
return _handleResult(res, request) | |
@@ -233,6 +236,7 @@ class _JSONConsumer(protocol.Protocol): | |
self.contents.append(data) | |
def connectionLost(self, reason=None): | |
contents = ''.join(self.contents) | |
+ print "woowoo", contents | |
# try: | |
self.deferred.callback(json.loads(contents)) | |
# except: | |
@@ -275,6 +279,7 @@ class Client(object): | |
# for param description.methodParams: | |
# url = urlparse.urljoin(url, kwargs[param]) | |
# del kwargs[param] | |
+ ## TODO: WE need special handling of the _user parameter | |
body = json.dumps(kwargs) | |
httpMethod = 'POST'#description.method | |
body = twclient.FileBodyProducer(StringIO(body)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment