+ return rc.NOT_HERE
+
+
+#
+# Dublin Core handlers
+#
+# @requires librarian
+#
+class DocumentDublinCoreHandler(BaseHandler):
+ allowed_methods = ('GET', 'PUT')
+
+ def read(self, request, docid):
+ """Read document as raw text"""
+ lib = MercurialLibrary(path=settings.REPOSITORY_PATH)
+ try:
+ doc = lib.document(docid, request.user.username)
+
+ # TODO: RAL:document should support file-like ops
+ bookinfo = dcparser.BookInfo.from_string(doc.read())
+ return bookinfo.serialize()
+ except CabinetNotFound:
+ return rc.NOT_HERE
+
+ def update(self, request, docid):
+ lib = MercurialLibrary(path=settings.REPOSITORY_PATH)
+ try:
+ data = request.PUT['contents']
+ lib.document(docid, request.user.username).write(data)
+ return rc.ALL_OK
+ except (CabinetNotFound, KeyError):
+ return rc.NOT_HERE
+