@hglibrary
def read(self, request, docid, lib):
"""Read document's meta data"""
- log.info("Read %s", docid)
+ log.info(u"Read %s (%s)" % (docid, type(docid)) )
try:
doc = lib.document(docid)
udoc = doc.take(request.user.username)
except RevisionNotFound, e:
return response.EntityNotFound().django_response({
- 'exception': type(e), 'message': e.message})
+ 'exception': type(e), 'message': e.message,
+ 'docid': docid })
# is_shared = udoc.ancestorof(doc)
# is_uptodate = is_shared or shared.ancestorof(document)
import wlrepo
from mercurial.node import nullid
+from mercurial import encoding
+encoding.encoding = 'utf-8'
+
class MercurialRevision(wlrepo.Revision):
def __init__(self, lib, changectx):
return self.document_for_rev(self.fulldocid(docid, user))
def get_revision(self, revid):
- revid = self._sanitize_string(revid)
+ revid = self._sanitize_string(revid).decode('utf-8')
+
+ print "Looking up rev %r (%s)" %(revid, type(revid))
try:
- ctx = self._changectx(revid)
+ # THIS IS THE MOST BRAIN-DEAD API I EVER SEEN
+ # WHY DO ALL THE OTHER METHODS SIMPLY
+ # FAIL WHEN GIVEN UNICODE, WHEN THIS WORKS ONLY!! WITH IT
+
+ ctx = self._changectx( revid.decode('utf-8') )
except mercurial.error.RepoError, e:
raise wlrepo.RevisionNotFound(revid)
fulldocid += u'$doc:' + docid
return fulldocid
-
def has_revision(self, revid):
try:
self._hgrepo[revid]
Editor.ToolbarButtonsModel = Editor.Model.extend({
- className: 'Editor.ToolbarButtonsModel',
- serverURL: '/api/toolbar/buttons',
+ className: 'Editor.ToolbarButtonsModel',
buttons: {},
init: function() {
load: function() {
if (!this.get('buttons').length) {
$.ajax({
- url: this.serverURL,
+ url: toolbarUrl,
dataType: 'json',
success: this.loadSucceeded.bind(this)
});
$(function()
{
documentsUrl = $('#api-base-url').text() + '/';
- Editor.ToolbarButtonsModel.serverURL = $('#api-toolbar-url').text();
+ toolbarUrl = $('#api-toolbar-url').text();
doc = new Editor.DocumentModel();
var editor = new EditorView('#body-wrap', doc);