~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/filesystem/serve/__init__.py

  • Committer: William Grant
  • Date: 2009-02-17 01:36:12 UTC
  • mto: (1099.1.143 new-dispatch)
  • mto: This revision was merged to the branch mainline in revision 1100.
  • Revision ID: grantw@unimelb.edu.au-20090217013612-7afzxjr1h32a6b1f
Change the serveservice interface to return the data outside JSON, immediately
after the trailing newline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
                [path])
110
110
    assert not err
111
111
 
112
 
    response = cjson.decode(out)
 
112
    # Remove the JSON from the front of the response, and decode it.
 
113
    json = out.split('\n', 1)[0]
 
114
    out = out[len(json) + 1:]
 
115
    response = cjson.decode(json)
 
116
 
113
117
    if 'error' in response:
114
118
        if response['error'] == 'not-found':
115
119
            raise NotFound()
119
123
            raise AssertionError('Unknown error from serveservice: %s' %
120
124
                                 response['error'])
121
125
 
122
 
    req.write(response['content'])
 
126
    req.write(out)
123
127
 
124
128
class Plugin(ViewPlugin):
125
129
    urls = [