fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5780495
)
VStorage now looks for <doc> if it couldn't find <doc>.xml
author
Łukasz Rekucki
<lrekucki@gmail.com>
Fri, 4 Jun 2010 19:15:38 +0000
(21:15 +0200)
committer
Łukasz Rekucki
<lrekucki@gmail.com>
Fri, 4 Jun 2010 19:15:38 +0000
(21:15 +0200)
apps/wiki/models.py
patch
|
blob
|
history
apps/wiki/templates/wiki/tabs/history_view.html
patch
|
blob
|
history
apps/wiki/templatetags/wiki.py
patch
|
blob
|
history
deployment.py
patch
|
blob
|
history
lib/vstorage/__init__.py
patch
|
blob
|
history
redakcja/settings/common.py
patch
|
blob
|
history
diff --git
a/apps/wiki/models.py
b/apps/wiki/models.py
index
d2b7460
..
acad2c3
100644
(file)
--- a/
apps/wiki/models.py
+++ b/
apps/wiki/models.py
@@
-15,12
+15,13
@@
from django.http import Http404
import logging
logger = logging.getLogger("fnp.wiki")
import logging
logger = logging.getLogger("fnp.wiki")
-_PCHARS_DICT = dict(zip((ord(x) for x in u"ĄĆĘŁŃÓŚŻŹąćęłńóśżź "), u"ACELNOSZZacelnoszz_"))
+
+# _PCHARS_DICT = dict(zip((ord(x) for x in u"ĄĆĘŁŃÓŚŻŹąćęłńóśżź "), u"ACELNOSZZacelnoszz_"))
+_PCHARS_DICT = dict(zip((ord(x) for x in u" "), u"_"))
# I know this is barbaric, but I didn't find a better solution ;(
def split_name(name):
parts = name.translate(_PCHARS_DICT).split('__')
# I know this is barbaric, but I didn't find a better solution ;(
def split_name(name):
parts = name.translate(_PCHARS_DICT).split('__')
- logger.info("SPLIT %r -> %r", name, parts)
return parts
def join_name(*parts, **kwargs):
return parts
def join_name(*parts, **kwargs):
diff --git
a/apps/wiki/templates/wiki/tabs/history_view.html
b/apps/wiki/templates/wiki/tabs/history_view.html
index
5e385ab
..
9f68dc4
100644
(file)
--- a/
apps/wiki/templates/wiki/tabs/history_view.html
+++ b/
apps/wiki/templates/wiki/tabs/history_view.html
@@
-4,7
+4,7
@@
<button type="button" id="make-diff-button">{% trans "Compare versions" %}</button>
<button type="button" id="tag-changeset-button">{% trans "Mark version" %}</button>
<button id="open-preview-button"
<button type="button" id="make-diff-button">{% trans "Compare versions" %}</button>
<button type="button" id="tag-changeset-button">{% trans "Mark version" %}</button>
<button id="open-preview-button"
- data-basehref="{% url wiki_
details
_readonly document_name %}">{% trans "View version" %}</button>
+ data-basehref="{% url wiki_
editor
_readonly document_name %}">{% trans "View version" %}</button>
</div>
<div id="history-view">
</div>
<div id="history-view">
diff --git
a/apps/wiki/templatetags/wiki.py
b/apps/wiki/templatetags/wiki.py
index
614858d
..
cb5bf20
100644
(file)
--- a/
apps/wiki/templatetags/wiki.py
+++ b/
apps/wiki/templatetags/wiki.py
@@
-5,7
+5,7
@@
from django import template
register = template.Library()
register = template.Library()
-
#
from wiki.models import split_name
+from wiki.models import split_name
@register.filter
@stringfilter
@register.filter
@stringfilter
diff --git
a/deployment.py
b/deployment.py
index
041b58c
..
3553aa1
100644
(file)
--- a/
deployment.py
+++ b/
deployment.py
@@
-29,13
+29,12
@@
def update_application():
os.system("pip install -r %s" % os.path.join(ROOT, 'etc', 'requirements.txt'))
print "done."
os.system("pip install -r %s" % os.path.join(ROOT, 'etc', 'requirements.txt'))
print "done."
-ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PYTHON = os.path.join(ROOT, 'pythonenv', 'bin', 'python')
PYTHON_SITE = os.path.join(ROOT, 'pythonenv', 'lib', 'python2.6', 'site-packages')
PROJECT_NAME = 'redakcja'
PYTHON = os.path.join(ROOT, 'pythonenv', 'bin', 'python')
PYTHON_SITE = os.path.join(ROOT, 'pythonenv', 'lib', 'python2.6', 'site-packages')
PROJECT_NAME = 'redakcja'
-PROJECT_ROOT = os.path.join(ROOT, 'app')
+PROJECT_ROOT = os.path.join(ROOT, 'app
lication
')
MEDIA_ROOT = os.path.join(ROOT, 'www', 'media')
MEDIA_ROOT = os.path.join(ROOT, 'www', 'media')
diff --git
a/lib/vstorage/__init__.py
b/lib/vstorage/__init__.py
index
aeb7338
..
9f7084b
100644
(file)
--- a/
lib/vstorage/__init__.py
+++ b/
lib/vstorage/__init__.py
@@
-326,33
+326,40
@@
class VersionedStorage(object):
def _find_filectx(self, title, rev=None):
"""Find the last revision in which the file existed."""
def _find_filectx(self, title, rev=None):
"""Find the last revision in which the file existed."""
- repo_file = self._title_to_file(title)
- changectx = self._changectx() # start with tip
- visited = set()
+ tip = self._changectx() # start with tip
- stack = [changectx]
- visited.add(changectx)
+ def tree_search(tip, repo_file):
+ logging.info("Searching for %r", repo_file)
+ current = tip
+ visited = set()
- while repo_file not in changectx:
- if not stack:
- raise DocumentNotFound(title)
+ stack = [current]
+ visited.add(current)
- changectx = stack.pop()
- for parent in changectx.parents():
- if parent not in visited:
- stack.append(parent)
- visited.add(parent)
+ while repo_file not in current:
+ if not stack:
+ raise LookupError
- try:
- fctx = changectx[repo_file]
+ current = stack.pop()
+ for parent in current.parents():
+ if parent not in visited:
+ stack.append(parent)
+ visited.add(parent)
+ fctx = current[repo_file]
if rev is not None:
fctx = fctx.filectx(rev)
fctx.filerev()
if rev is not None:
fctx = fctx.filectx(rev)
fctx.filerev()
-
return fctx
return fctx
+
+ try:
+ return tree_search(tip, self._title_to_file(title))
except (IndexError, LookupError) as e:
except (IndexError, LookupError) as e:
- raise DocumentNotFound(title)
+ logging.info("XML file not found, trying plain")
+ try:
+ return tree_search(tip, self._title_to_file(title, type=''))
+ except (IndexError, LookupError) as e:
+ raise DocumentNotFound(title)
def page_history(self, title):
"""Iterate over the page's history."""
def page_history(self, title):
"""Iterate over the page's history."""
diff --git
a/redakcja/settings/common.py
b/redakcja/settings/common.py
index
379f5b5
..
377a4d5
100644
(file)
--- a/
redakcja/settings/common.py
+++ b/
redakcja/settings/common.py
@@
-141,6
+141,8
@@
WL_API_CONFIG = {
# Import localsettings file, which may override settings defined here
# Import localsettings file, which may override settings defined here
+from localsettings import *
+
try:
import logging
if os.path.isfile(LOGGING_CONFIG_FILE):
try:
import logging
if os.path.isfile(LOGGING_CONFIG_FILE):
@@
-149,8
+151,5
@@
try:
else:
import sys
logging.basicConfig(stream=sys.stderr)
else:
import sys
logging.basicConfig(stream=sys.stderr)
-except NameError:
- print "No logging"
- pass
except ImportError as exc:
raise
except ImportError as exc:
raise