[Twisted-Python] Woven dynamic table, patterns and idioms wanted.
I am finally beginning to grasp woven, but I have a bit of code in my woven application that seems to reimplement views and would like some advice on how to avoid that. The scenerio is as follows: I have a table with a header and a rows where each row present an object. I use view="List" but I can't specify each attribute in the object as a column in the table with model and view because these are dynamic. In a static solution this would look something like this: <table model="myModel" view="List"> <tr pattern="listItem"> <td model="anAttribute" view="Text" /> <td model="anotherAttribute" view="Date" /> <td model="aThirdAttribute" view="Money" /> </tr> </table> The solution that I use now which works okay is to just specify a custom view on the whole object (for each row) and use that view to generate the xml, including custom formatting and so on. This means that I basically reimplement the woven view functionality. What I have now is something like this: <table model="myModel" view="List"> <tr pattern="listItem" view="myCustomTableRowView"/> </table> Where myCustomTableRowView basically loops through a table listing the required fields and formatting for this kind of object, creates a td for each of them, formats the data. My naive take on this would be to be able to specify model and view attributes on the xml I generate, but when I tried this it wouldn't work, I guess it is to late in the process to do so. If anyone has any ideas on woven idioms/patterns for this type of application, I would be glad to hear of it.
participants (1)
-
Syver Enstad