- 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
+ return JSONResponse({"result": api.publish_book(document)})
+ except wlapi.APICallException, e:
+ return JSONServerError({"message": str(e)})