-def document_history(reuqest, name):
- return HttpResponse( json.dumps(storage.history(name), cls=DateTimeEncoder), mimetype='application/json')
+@never_cache
+def document_publish(request, name, version):
+ storage = getstorage()
+
+ # get the document
+ try:
+ document = storage.get(name, revision = int(version))
+ except DocumentNotFound:
+ raise Http404
+
+ api = wlapi.WLAPI(settings.WL_API_CONFIG)
+ try:
+ result = {"success": True, "result": api.publish_book(document)}
+ except wlapi.APICallException, e:
+ result = {"success": False, "reason": str(e)}
+
+ return HttpResponse( json.dumps(result), mimetype='application/json')
\ No newline at end of file