result = {
'name': doc.id,
- 'html_url': reverse('dochtml_view', args=[doc.id,doc.revision]),
- 'text_url': reverse('doctext_view', args=[doc.id,doc.revision]),
- 'dc_url': reverse('docdc_view', args=[doc.id,doc.revision]),
+ 'html_url': reverse('dochtml_view', args=[doc.id]),
+ 'text_url': reverse('doctext_view', args=[doc.id]),
+ 'dc_url': reverse('docdc_view', args=[doc.id]),
'public_revision': doc.revision,
}
result = {
'name': udoc.id,
- 'html_url': reverse('dochtml_view', args=[udoc.id,udoc.revision]),
- 'text_url': reverse('doctext_view', args=[udoc.id,udoc.revision]),
- 'dc_url': reverse('docdc_view', args=[udoc.id,udoc.revision]),
+ 'html_url': reverse('dochtml_view', args=[udoc.id]),
+ 'text_url': reverse('doctext_view', args=[udoc.id]),
+ 'dc_url': reverse('docdc_view', args=[udoc.id]),
'gallery_url': reverse('docgallery_view', args=[udoc.id]),
'merge_url': reverse('docmerge_view', args=[udoc.id]),
'user_revision': udoc.revision,
allowed_methods = ('GET')
@hglibrary
- def read(self, request, docid, revision, lib):
+ def read(self, request, docid, lib):
"""Read document as html text"""
try:
+ revision = request.GET.get('revision', 'latest')
+
if revision == 'latest':
document = lib.document(docid)
else:
#
#
class DocumentTextHandler(BaseHandler):
- allowed_methods = ('GET', 'PUT')
+ allowed_methods = ('GET', 'POST')
@hglibrary
- def read(self, request, docid, revision, lib):
- """Read document as raw text"""
+ def read(self, request, docid, lib):
+ """Read document as raw text"""
+ revision = request.GET.get('revision', 'latest')
try:
if revision == 'latest':
document = lib.document(docid)
'exception': type(e), 'message': e.message})
@hglibrary
- def update(self, request, docid, revision, lib):
+ def create(self, request, docid, lib):
try:
- data = request.PUT['contents']
+ data = request.POST['contents']
+ revision = request.POST['revision']
- if request.PUT.has_key('message'):
- msg = u"$USER$ " + request.PUT['message']
+ if request.POST.has_key('message'):
+ msg = u"$USER$ " + request.POST['message']
else:
msg = u"$AUTO$ XML content update."
"previous_revision": current.revision,
"revision": ndoc.revision,
'timestamp': ndoc.revision.timestamp,
- "url": reverse("doctext_view", args=[ndoc.id, ndoc.revision])
+ "url": reverse("doctext_view", args=[ndoc.id])
})
except Exception, e:
if ndoc: lib._rollback()
# @requires librarian
#
class DocumentDublinCoreHandler(BaseHandler):
- allowed_methods = ('GET', 'PUT')
+ allowed_methods = ('GET', 'POST')
@hglibrary
- def read(self, request, docid, revision, lib):
+ 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:
'exception': type(e), 'message': e.message})
@hglibrary
- def update(self, request, docid, revision, lib):
+ def create(self, request, docid, lib):
try:
- bi_json = request.PUT['contents']
- if request.PUT.has_key('message'):
+ 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."
"previous_revision": current.revision,
"revision": ndoc.revision,
'timestamp': ndoc.revision.timestamp,
- "url": reverse("docdc_view", args=[ndoc.id, ndoc.revision])
+ "url": reverse("docdc_view", args=[ndoc.id])
}
except Exception, e:
if ndoc: lib._rollback()
FORMAT = r"\.(?P<emitter_format>xml|json|yaml)"
DOC = r'(?P<docid>[^/]+)'
-REVISION = r'(?P<revision>latest|[0-9a-f]{40})'
+# REVISION = r'(?P<revision>latest|[0-9a-f]{40})'
def urlpath(*args, **kwargs):
format = kwargs.get('format', True)
url(urlpath(r'documents'), library_resource,
name="document_list_view_withformat"),
- url(urlpath(r'documents', DOC),
- document_resource, name="document_view_withformat"),
+ #url(urlpath(r'documents', DOC),
+ # document_resource, name="document_view_withformat"),
url(urlpath(r'documents', DOC, format=False),
document_resource, {'emitter_format': 'json'},
name="docgallery_view"),
# XML
- url(urlpath(r'documents', DOC, 'text', REVISION, format=False),
+ url(urlpath(r'documents', DOC, 'text', format=False),
document_text_resource, {'emitter_format': 'rawxml'},
name="doctext_view"),
# HTML
- url(urlpath(r'documents', DOC, 'html', REVISION, format=False),
+ url(urlpath(r'documents', DOC, 'html', format=False),
document_html_resource, {'emitter_format': 'rawhtml'},
name="dochtml_view"),
# DC
- url(urlpath(r'documents', DOC, 'dc', REVISION),
- document_dc_resource,
- name="docdc_view_withformat"),
+ #url(urlpath(r'documents', DOC, 'dc'),
+ # document_dc_resource,
+ # name="docdc_view_withformat"),
- url(urlpath(r'documents', DOC, 'dc', REVISION, format=False),
+ url(urlpath(r'documents', DOC, 'dc', format=False),
document_dc_resource, {'emitter_format': 'json'},
name="docdc_view"),