+#
+#
+#
+
+class DocumentHTMLHandler(BaseHandler):
+ allowed_methods = ('GET', 'PUT')
+
+ @hglibrary
+ def read(self, request, docid, revision, lib):
+ """Read document as html text"""
+ try:
+ if revision == 'latest':
+ document = lib.document(docid)
+ else:
+ document = lib.document_for_rev(revision)
+
+ return librarian.html.transform(document.data('xml'))
+ except RevisionNotFound:
+ return response.EntityNotFound().django_response()