--- /dev/null
+# this view is what the javascript talks to when it sends a query
+# see also
+# myslice/urls.py
+# as well as
+# static/js/manifold-async.js
+
+from django.core import serializers
+from django.http import HttpResponse
+
+# xxx should probably cater for
+# format_in : how is the query encoded in POST
+# format_out: how to serve the results
+def api (request,format):
+ # expecting a POST
+ if request.method != 'POST':
+ print "manifoldproxy.api: unexpected method %s -- exiting"%request.method
+ return
+ # we only support json for now
+ if format != 'json':
+ print "manifoldproxy.api: unexpected format %s -- exiting"%format
+ return
+
+ # xxx actually ask the backend here
+ hard_wired_answer = {'a':'some string','b':123}
+ return HttpResponse (serializers.serialize("json",hard_wired_answer),
+ mimetype="application/json")
# Examples:
# url(r'^$', 'myslice.views.home', name='home'),
# url(r'^myslice/', include('myslice.foo.urls')),
-
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
+ #
+ # default / view
+ #
(r'^/?$', default_view),
+ #
+ # login / logout
+ #
(r'^login-ok/?$', after_login_view),
# seems to be what login_required uses to redirect ...
(r'^accounts/login/$', 'auth.views.login_user'),
(r'^login/?$', 'auth.views.login_user'),
(r'^logout/?$', 'auth.views.logout_user'),
(r'^logout/confirm/?$', 'auth.views.do_logout_user'),
+ #
+ # the manifold proxy
+ #
+ (r'^manifold/api/(?P<format>\w+)/?$', 'engine.manifoldproxy.api'),
+ #
+ # various trash views
+ #
(r'^slice/?$', 'trash.sampleviews.slice_view'),
(r'^slice/(?P<name>[\w\.]+)/?$', 'trash.sampleviews.slice_view'),
(r'^tab/?$', 'trash.sampleviews.tab_view'),