+#
+# Dublin Core handlers
+#
+# @requires librarian
+#
+#class DocumentDublinCoreHandler(BaseHandler):
+# allowed_methods = ('GET', 'POST')
+#
+# @hglibrary
+# def read(self, request, docid, lib):
+# """Read document as raw text"""
+# try:
+# revision = request.GET.get('revision', 'latest')
+#
+# if revision == 'latest':
+# doc = lib.document(docid)
+# else:
+# doc = lib.document_for_rev(revision)
+#
+#
+# if document.id != docid:
+# return response.BadRequest().django_response({'reason': 'name-mismatch',
+# 'message': 'Provided revision is not valid for this document'})
+#
+# bookinfo = dcparser.BookInfo.from_string(doc.data('xml'))
+# return bookinfo.serialize()
+# except (EntryNotFound, RevisionNotFound), e:
+# return response.EntityNotFound().django_response({
+# 'exception': type(e), 'message': e.message})
+#
+# @hglibrary
+# def create(self, request, docid, lib):
+# try:
+# bi_json = request.POST['contents']
+# revision = request.POST['revision']
+#
+# if request.POST.has_key('message'):
+# msg = u"$USER$ " + request.PUT['message']
+# else:
+# msg = u"$AUTO$ Dublin core update."
+#
+# current = lib.document(docid, request.user.username)
+# orig = lib.document_for_rev(revision)
+#
+# if current != orig:
+# return response.EntityConflict().django_response({
+# "reason": "out-of-date",
+# "provided": orig.revision,
+# "latest": current.revision })
+#
+# xmldoc = parser.WLDocument.from_string(current.data('xml'))
+# document.book_info = dcparser.BookInfo.from_json(bi_json)
+#
+# # zapisz
+# ndoc = current.quickwrite('xml', \
+# document.serialize().encode('utf-8'),\
+# message=msg, user=request.user.username)
+#
+# try:
+# # return the new revision number
+# return {
+# "document": ndoc.id,
+# "subview": "dc",
+# "previous_revision": current.revision,
+# "revision": ndoc.revision,
+# 'timestamp': ndoc.revision.timestamp,
+# "url": reverse("docdc_view", args=[ndoc.id])
+# }
+# except Exception, e:
+# if ndoc: lib._rollback()
+# raise e
+# except RevisionNotFound:
+# return response.EntityNotFound().django_response()