Commit 22dfe695 authored by oggei's avatar oggei

* paginate video search results

* making author browsing more friendly, another check for wrong uris
parent ed0d45f8
......@@ -8,9 +8,10 @@ class AuthorController(BaseController):
def index(self, id):
c.author = model.Author.query.get(int(id))
if not h.logged_in() and c.author.status != model.Author.Status.AUTHOR \
and c.author.status != model.Author.Status.ADMIN:
abort(404)
if (not h.logged_in() and c.author.status != model.Author.Status.AUTHOR \
and c.author.status != model.Author.Status.ADMIN) or not c.author:
#abort(404)
redirect_to('list?e=1')
res = model.VideoQuery.query([
('author', c.author.author_id),
('latest', None)
......@@ -21,6 +22,7 @@ class AuthorController(BaseController):
def list(self):
c.page_num = int(request.params.get('p', 0))
c.err = int(request.params['e'])
c.authors = h.Page(
model.Author.all_authors(status=model.Author.Status.AUTHOR),
page=c.page_num)
......
......@@ -8,6 +8,9 @@ ${_('All authors')}
${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, '')}
% for a in c.authors:
${self.snippets.author(a)}
% endfor
......@@ -25,6 +25,7 @@ onload="document.forms[0].q.focus();"
% if c.results:
<hr/>
${c.results.pager('Page $page: $link_previous $link_next ~4~', page_param='p', q=c.query)}
<% base_color = (125, 130, 230) %>
% for res in c.results:
<%
......
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