Someone
public python v1 · immutableimport 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')