The controller is like:
 def list(self):
    records = meta.Session.query(model.Page)
    c.paginator = paginate.Page(
        records,
        page=int(request.params.get('page', 1)),
        items_per_page = 10,
    )
    return render('/derived/page/list.html')
And list.html is:
<%inherit file="/base/index.html" />

<%def name="heading()"><h1>Page List</h1></%def>

<%def name="buildrow(page, odd=True)">
    %if odd:
        <tr class="odd">
    %else:
        <tr class="even">
    % endif
        <td valign="top">
            ${h.link_to(
                page.id,
                h.url_for(
                    controller=u'page',
                    action='view',
                    id=unicode(page.id)
                )
            )}
        </td>
        <td valign="top">
            ${page.title}
        </td>
        <td valign="top">${page.posted.strftime('%c')}</td>
        </tr>
</%def>

% if len(c.paginator):
<p>${ c.paginator.pager('$link_first $link_previous $first_item to
$last_item of $item_count $link_next $link_last') }</p>
<table class="paginator"><tr><th>Page ID</th><th>Page Title</
th><th>Posted</th></tr>
<% counter=0 %>
% for item in c.paginator:
    ${buildrow(item, counter%2)}
    <% counter += 1 %>
% endfor
</table>
<p>${ c.paginator.pager('~2~') }</p>
% else:
<p>No pages have yet been created. <a href="${h.url_for
(controller='page', action='new')}">Add one</a>.</p>
% endif
However when I try to browse it, nothing show up in browser.
Messages showed by server in command line are:
16:13:02,312 INFO  [sqlalchemy.engine.base.Engine.0x...a450] BEGIN
16:13:02,328 INFO  [sqlalchemy.engine.base.Engine.0x...a450] SELECT
page.id AS p
age_id, page.content AS page_content, page.posted AS page_posted,
page.title AS
page_title, page.heading AS page_heading
FROM page
16:13:02,328 INFO  [sqlalchemy.engine.base.Engine.0x...a450] []
Anybody help me ? thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to