The answer was to return content-type text/plain instead of application/json. To do this in TurboGears 2.1, I followed an example from Pylons. My controller now looks like this:
@expose()
def uploadFile(self,**kwargs):
""" Simple controller to handle uploaded files
"""Note the response.headers['Content-type'] = "text/plain" - and that I left out the expose('json') which you would normally use in TurboGears to return json...
# do stuff such as handle file upload...
response.headers['Content-type'] = "text/plain"
return dict(info={'filesize':50000,'filename':'whatever')
Keine Kommentare:
Kommentar veröffentlichen