'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]),
+ #'gallery_url': reverse('docdc_view', args=[udoc.id,udoc.revision]),
'user_revision': udoc.revision,
'public_revision': doc.revision,
}
except RevisionNotFound:
return response.EntityNotFound().django_response()
-
-
-
#
# Document Text View
#
XINCLUDE_REGEXP = r"""<(?:\w+:)?include\s+[^>]*?href=("|')wlrepo://(?P<link>[^\1]+?)\1\s*[^>]*?>"""
#
#
+#
class DocumentTextHandler(BaseHandler):
allowed_methods = ('GET', 'PUT')
if ndoc: lib._rollback()
raise e
except RevisionNotFound, e:
- return response.EntityNotFound().django_response(e)
+ return response.EntityNotFound(mimetype="text/plain").\
+ django_response(e.message)
+
#
# Dublin Core handlers
"document": ndoc.id,
"subview": "dc",
"previous_revision": current.revision,
- "updated_revision": ndoc.revision
+ "updated_revision": ndoc.revision,
+ "url": reverse("docdc_view", args=[ndoc.id, ndoc.revision])
}
except Exception, e:
- lib._rollback()
+ if ndoc: lib._rollback()
raise e
except RevisionNotFound:
return response.EntityNotFound().django_response()
-
-
class MergeHandler(BaseHandler):
allowed_methods = ('POST',)
elif self._mime == MIME_JSON:
data = json.dumps(body, default=lambda o: repr(o) )
else:
- data = u"%s\n%s" % (self.MESSAGE, unicode(body))
- data = data.encode('utf-8')
+ # data = u"%s\n%s" % (self.MESSAGE, unicode(body))
+ data = unicode(body).encode('utf-8')
return HttpResponse(content=data, status=self._code, \
content_type=self._mime+'; charset=utf-8' )
def get_revision(self, revid):
revid = self._sanitize_string(revid)
-
- ctx = self._changectx(revid)
+
+ try:
+ ctx = self._changectx(revid)
+ except mercurial.error.RepoError, e:
+ raise wlrepo.RevisionNotFound(revid)
if ctx is None:
- raise RevisionNotFound(revid)
+ raise wlrepo.RevisionNotFound(revid)
if self._revcache.has_key(ctx):
return self._revcache[ctx]
try:
self._hgrepo[revid]
return True
- except error.RepoError:
+ except mercurial.error.RepoError:
return False
def document_create(self, docid):