1 # this view is what the javascript talks to when it sends a query
5 # static/js/manifold-async.js
7 from django.core import serializers
8 from django.http import HttpResponse
10 # xxx should probably cater for
11 # format_in : how is the query encoded in POST
12 # format_out: how to serve the results
13 def api (request,format):
15 if request.method != 'POST':
16 print "manifoldproxy.api: unexpected method %s -- exiting"%request.method
18 # we only support json for now
20 print "manifoldproxy.api: unexpected format %s -- exiting"%format
23 # xxx actually ask the backend here
24 hard_wired_answer = {'a':'some string','b':123}
25 return HttpResponse (serializers.serialize("json",hard_wired_answer),
26 mimetype="application/json")