Skip to content

Instantly share code, notes, and snippets.

@kpricorn
Created December 30, 2011 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpricorn/1539716 to your computer and use it in GitHub Desktop.
Save kpricorn/1539716 to your computer and use it in GitHub Desktop.
Page and Fragment
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