Commit d65c0861 authored by oggei's avatar oggei

* corrected an authors list bug

* corrected docs controller for better redirects handling
* small change to thumbnails pagination
parent 6f071b97
......@@ -22,7 +22,7 @@ class AuthorController(BaseController):
def list(self):
c.page_num = int(request.params.get('p', 0))
c.err = int(request.params['e'])
c.err = request.params.get('e', None)
c.authors = h.Page(
model.Author.all_authors(status=model.Author.Status.AUTHOR),
page=c.page_num)
......
......@@ -9,14 +9,18 @@ log = logging.getLogger(__name__)
class DocsController(BaseController):
def index(self):
return redirect_to(action='view', title='Home')
redirect_to(controller='/docs', action='view')
def view(self, title):
def view(self, title='Home'):
c.doc = model.Document.query.filter_by(title=title).first()
if not c.doc:
if request.environ.has_key('HTTP_REFERER'):
match = re.search(r'/view/(\w+)$', request.environ['HTTP_REFERER'])
matching_doc = model.Document.query.filter_by(title=match.group(1)).first()
if match:
title = match.group(1)
else:
title = 'Home'
matching_doc = model.Document.query.filter_by(title=title).first()
if matching_doc:
c.parent_id = matching_doc.id
return render('docs/create.html')
......
......@@ -127,7 +127,7 @@ class DocumentRevision(object):
if match.group(6):
title = match.group(6)
return h.link_to(title,
url=h.url_for(controller='docs', action='view',
url=h.url_for(controller='/docs', action='view',
title=title))
return '<span class="wikierror">%s</span>' % match.group(1)
return self.__wikiwords.sub(replace_func, self.contents)
......
......@@ -72,6 +72,7 @@
.screenshot {
padding: 2px;
border: 1px solid black;
margin-left: 1em;
}
/* status color codes */
......
......@@ -10,7 +10,7 @@ ${c.authors.pager('Page $page: $link_previous $link_next ~4~', page_param='p')}
${dict([
(1, "Author doesn't exists, showing you whole list"),
]).get(c.err, '')}
]).get(int(c.err), '')}
% for a in c.authors:
${self.snippets.author(a)}
% endfor
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment