diff options
-rwxr-xr-x | sugar-network | 7 | ||||
-rw-r--r-- | sugar_network/local/mounts.py | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sugar-network b/sugar-network index e2f2856..831939b 100755 --- a/sugar-network +++ b/sugar-network @@ -70,6 +70,13 @@ class Application(application.Application): self._call('GET', None) def _call(self, method, content=None): + if content: + try: + content = json.loads(content) + except Exception, error: + printf.info('Cannot parse JSON from stdin: %s', error) + return + request = Request(method=method) request.content = content response = ad.Response() diff --git a/sugar_network/local/mounts.py b/sugar_network/local/mounts.py index 0c36238..cfe9a1e 100644 --- a/sugar_network/local/mounts.py +++ b/sugar_network/local/mounts.py @@ -206,11 +206,12 @@ class _ProxyCommands(object): reply.remove(prop) request['reply'] = reply elif command in (('POST', None), ('PUT', None)): - for prop in _LOCAL_PROPS.keys(): - if prop in request.content: - patch[prop] = request.content.pop(prop) - if not request.content: + if request.content is None: result = guid + else: + for prop in _LOCAL_PROPS.keys(): + if prop in request.content: + patch[prop] = request.content.pop(prop) if result is None: result = super_call(request, response) |