Hi, I've got <dtml-tree> which branches_expr calls a method which returns a list of mappings. e.g. : [ { 'name' : 'jerome', 'age' : 72 }, { 'name' : 'albert', 'age': 2}, ... ] now in the body of the tree tag, I want to access each mapping, i.e. push it onto the current namespace. I've tried to add the "mapping" keyword, which works fine for <dtml-in>, but with no luck. I wanted to use the _.namespace() method, but I can't access the tree's "pseudo-sequence-item". is there a solution ? if no, then could the 'mapping' keyword be added to the tree tag and let it work like for dtml-in ? (I've looked at the code but I really don't know how to do) Any help appreciated Thanks in advance Jerome Alet
Jerome Alet writes:
I've got <dtml-tree> which branches_expr calls a method which returns a list of mappings. .... is there a solution ? I fear "dtml-tree" requires a list of objects not mappings.
if no, then could the 'mapping' keyword be added to the tree tag and let it work like for dtml-in ? (I've looked at the code but I really don't know how to do) In principle, yes. But it would be quite some work.
I would go a different route: * extend "ZPublisher.HTTPRequest.record" by a useful "__init__" method: def __init__(self,**kw): d= self.__dict__ for k,v in kw.items(): d[k]= v * make it accessible from Python Scripts and ZPT by providing some useful security declarations * make it available to DTML by adding it to "TemplateDict" in "DocumentTemplate.DT_Util". This would make simple "record" instance construction available for TTW code, something lacking from Zope! Dieter
participants (2)
-
Dieter Maurer -
Jerome Alet