--- /dev/null
+from itertools import cycle, islice # etc.
+from os.path import isfile # for example
+import genshi_namespace
from django.http import HttpResponse, HttpRequest
from genshi.template import TemplateLoader
from genshi.filters import Translator
ns['models'] = models
ns['request'] = request
ns['user'] = getattr(request, 'user', None)
-
-
+ ns.update(genshi_namespace.__dict__)
}
.pagetable td { border: #ddd 1px solid; padding: 4 8; }
-.pagetable thead th { font-size: smaller; text-align: left; padding: 2 8; }
\ No newline at end of file
+.pagetable .odd {
+ background-color: #F8F8F8;
+}
+.pagetable thead th { font-size: smaller; text-align: left; padding: 2 8; }
<tr py:def="pageheader()">
<th>Term</th><th>Code</th><th>Title</th>
</tr>
- <tr py:def="pagerow(item)">
+ <span py:def="pagerow(item)">
<td>${item.term}</td>
<td><a href="../course/${item.id}/">${item.code}</a></td>
<td><a href="../course/${item.id}/">${item.title}</a></td>
- </tr>
+ </span>
+ <!--
${pagetable(paginator, start, count, pagerow, pageheader)}
+ -->
+ ${pagetable(paginator, count, pagerow, pageheader)}
</body>
</html>
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
-<div py:def="pagetable(paginator, start, count, pagerow, pagehead=None)"
+<div py:def="pagetable(paginator, count, pagerow, pagehead=None)"
py:with="page = paginator.page(page_num)">
- <table class="pagetable">
+ <table class="pagetable" py:with="cls = cycle(('odd', 'even'))">
<thead py:if="pagehead">
${pagehead()}
</thead>
<tbody>
<tr py:strip="True" py:for="item in page.object_list">
+ <tr class="${cls.next()}">
${pagerow(item)}
+ </tr>
</tr>
</tbody>
</table>
</span>
</div>
</div>
-</html>
\ No newline at end of file
+</html>