All pastes #184281 Raw Edit

Someone

public python v1 · immutable
#184281 ·published 2006-09-27 19:08 UTC
rendered paste body
import sysfrom genshi.template import MarkupTemplate, Contextclass Indexable(object):  def __str__(self):    return "foo"    def __getitem__(self, key):    print key    return None  #def __iter__(self): return Nonecontext = { 'contextbomb': Indexable() }text = """<div xmlns="http://www.w3.org/1999/xhtml"  xmlns:py="http://genshi.edgewall.org/">  ${contextbomb}</div>"""print texttmpl = MarkupTemplate(text)stream = tmpl.generate(**context)print stream.render('xhtml')