fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
755cace
)
Hope i fixed the stange - "not found" annomaly.
author
Łukasz Rekucki
<lrekucki@gmail.com>
Fri, 2 Oct 2009 11:05:36 +0000
(13:05 +0200)
committer
Łukasz Rekucki
<lrekucki@gmail.com>
Fri, 2 Oct 2009 11:05:36 +0000
(13:05 +0200)
apps/api/handlers/library_handlers.py
patch
|
blob
|
history
lib/wlrepo/mercurial_backend/__init__.py
patch
|
blob
|
history
lib/wlrepo/mercurial_backend/library.py
patch
|
blob
|
history
project/static/js/models.js
patch
|
blob
|
history
diff --git
a/apps/api/handlers/library_handlers.py
b/apps/api/handlers/library_handlers.py
index
93d650b
..
c5c5256
100644
(file)
--- a/
apps/api/handlers/library_handlers.py
+++ b/
apps/api/handlers/library_handlers.py
@@
-177,13
+177,14
@@
class DocumentHandler(BaseHandler):
@hglibrary
def read(self, request, docid, lib):
"""Read document's meta data"""
@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({
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)
# is_shared = udoc.ancestorof(doc)
# is_uptodate = is_shared or shared.ancestorof(document)
diff --git
a/lib/wlrepo/mercurial_backend/__init__.py
b/lib/wlrepo/mercurial_backend/__init__.py
index
a22e49f
..
f919e81
100644
(file)
--- a/
lib/wlrepo/mercurial_backend/__init__.py
+++ b/
lib/wlrepo/mercurial_backend/__init__.py
@@
-7,6
+7,9
@@
__doc__ = "Module documentation."
import wlrepo
from mercurial.node import nullid
import wlrepo
from mercurial.node import nullid
+from mercurial import encoding
+encoding.encoding = 'utf-8'
+
class MercurialRevision(wlrepo.Revision):
def __init__(self, lib, changectx):
class MercurialRevision(wlrepo.Revision):
def __init__(self, lib, changectx):
diff --git
a/lib/wlrepo/mercurial_backend/library.py
b/lib/wlrepo/mercurial_backend/library.py
index
f033fce
..
8c57f03
100644
(file)
--- a/
lib/wlrepo/mercurial_backend/library.py
+++ b/
lib/wlrepo/mercurial_backend/library.py
@@
-96,10
+96,16
@@
class MercurialLibrary(wlrepo.Library):
return self.document_for_rev(self.fulldocid(docid, user))
def get_revision(self, revid):
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:
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)
except mercurial.error.RepoError, e:
raise wlrepo.RevisionNotFound(revid)
@@
-118,7
+124,6
@@
class MercurialLibrary(wlrepo.Library):
fulldocid += u'$doc:' + docid
return fulldocid
fulldocid += u'$doc:' + docid
return fulldocid
-
def has_revision(self, revid):
try:
self._hgrepo[revid]
def has_revision(self, revid):
try:
self._hgrepo[revid]
diff --git
a/project/static/js/models.js
b/project/static/js/models.js
index
b32f192
..
5c6b36d
100644
(file)
--- a/
project/static/js/models.js
+++ b/
project/static/js/models.js
@@
-6,8
+6,7
@@
Editor.Model = Editor.Object.extend({
Editor.ToolbarButtonsModel = Editor.Model.extend({
Editor.ToolbarButtonsModel = Editor.Model.extend({
- className: 'Editor.ToolbarButtonsModel',
- serverURL: '/api/toolbar/buttons',
+ className: 'Editor.ToolbarButtonsModel',
buttons: {},
init: function() {
buttons: {},
init: function() {
@@
-17,7
+16,7
@@
Editor.ToolbarButtonsModel = Editor.Model.extend({
load: function() {
if (!this.get('buttons').length) {
$.ajax({
load: function() {
if (!this.get('buttons').length) {
$.ajax({
- url: t
his.serverURL
,
+ url: t
oolbarUrl
,
dataType: 'json',
success: this.loadSucceeded.bind(this)
});
dataType: 'json',
success: this.loadSucceeded.bind(this)
});
@@
-404,7
+403,7
@@
var leftPanelView, rightPanelContainer, doc;
$(function()
{
documentsUrl = $('#api-base-url').text() + '/';
$(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);
doc = new Editor.DocumentModel();
var editor = new EditorView('#body-wrap', doc);