from django.conf.urls.defaults import *
-from django.conf import settings
urlpatterns = patterns('wiki.views',
url(r'^$',
'document_list', name='wiki_doclist'),
+
url(r'^create/(?P<name>[^/]+)',
'document_create_missing', name='wiki_create_missing'),
+
url(r'^gallery/(?P<directory>[^/]+)$',
'document_gallery', name="wiki_gallery"),
url(r'^(?P<name>[^/]+)/history$',
"""Find the last revision in which the file existed."""
repo_file = self._title_to_file(title)
changectx = self._changectx() # start with tip
+ visited = set()
+
stack = [changectx]
+ visited.add(changectx)
while repo_file not in changectx:
if not stack:
- return None
+ raise DocumentNotFound(title)
changectx = stack.pop()
for parent in changectx.parents():
- if parent != changectx:
+ if parent not in visited:
stack.append(parent)
+ visited.add(parent)
try:
fctx = changectx[repo_file]
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
+ url(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/documents/'}),
+ url(r'^documents/', include('wiki.urls')),
+
# Static files (should be served by Apache)
url(r'^%s(?P<path>.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
url(r'^%s(?P<path>.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
-
- url(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/documents/'}),
- url(r'^documents/', include('wiki.urls')),
)