fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
first take on The Great Import
[redakcja.git]
/
apps
/
wiki
/
views.py
diff --git
a/apps/wiki/views.py
b/apps/wiki/views.py
index
75650e0
..
adffcb7
100644
(file)
--- a/
apps/wiki/views.py
+++ b/
apps/wiki/views.py
@@
-114,7
+114,10
@@
def text(request, slug, chunk=None):
author = None
text = form.cleaned_data['text']
parent_revision = form.cleaned_data['parent_revision']
author = None
text = form.cleaned_data['text']
parent_revision = form.cleaned_data['parent_revision']
- parent = doc.at_revision(parent_revision)
+ if parent_revision is not None:
+ parent = doc.at_revision(parent_revision)
+ else:
+ parent = None
stage = form.cleaned_data['stage_completed']
tags = [stage] if stage else []
doc.commit(author=author,
stage = form.cleaned_data['stage_completed']
tags = [stage] if stage else []
doc.commit(author=author,
@@
-137,12
+140,17
@@
def text(request, slug, chunk=None):
try:
revision = int(revision)
except (ValueError, TypeError):
try:
revision = int(revision)
except (ValueError, TypeError):
- revision = None
+ revision = doc.revision()
+
+ if revision is not None:
+ text = doc.at_revision(revision).materialize()
+ else:
+ text = ''
return JSONResponse({
return JSONResponse({
- 'text':
doc.at_revision(revision).materialize()
,
+ 'text':
text
,
'meta': {},
'meta': {},
- 'revision': revision
if revision else doc.revision()
,
+ 'revision': revision,
})
})