Skip to content

Instantly share code, notes, and snippets.

@moshez
Created May 13, 2013 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moshez/5566146 to your computer and use it in GitHub Desktop.
Save moshez/5566146 to your computer and use it in GitHub Desktop.
Where logs are needed in txmob
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