Created
December 30, 2011 12:55
-
-
Save kpricorn/1539716 to your computer and use it in GitHub Desktop.
Page and Fragment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IterPage(WebConfig): | |
docFactory = loaders.xmlfile(util.sibpath(__file__, 'templates/iter.xhtml')) | |
addSlash = False | |
def data_rows(self, ctx, data): | |
return [ | |
[ 1, 2, 3 ], | |
[ 1 ], | |
[ 1, 4, 9, 3 ], | |
] | |
def render_row(self, ctx, row): | |
return ctx.tag[RowFragment(row)] | |
class RowFragment(rend.Fragment): | |
def __init__(self, row): | |
self.row = row | |
def rend(self, context, data): | |
return t.ul[ | |
map(lambda x: t.li[x], data) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment