Dear all, I'm now looking into ChangesetModule._render_html() and most of its (almost) 300 lines just transform certain data from one representation to another, so that the template engine could perform yet another transformation of this data to an html page!
I was thinking, wouldn't it be nice, simple and straightforward to pass python objects rather than dictionaries to the template engine. My opinion is that generally a more object-oriented approach would improve readability and eliminate unnecessary data transformations. Let's take for example the changeset page, which contains a title, a message, other properties and a list of file changes. A file change is between two nodes and has a type attribute and a list of content changes. The nodes have their own attributes like path and revision. The template file would know this structure and would know how to represent the objects as html content. I just very recently did something with XML and XSLT and the concept is really great! Trac already uses a similar concept but not quite... What I suggest is to use python objects to represent the document (think of XML) and use genshi templates to render the final content (just as XSL would have done). Currently some of the rendering is done in web_ui and the rest is done in the templates. Better would be if the modules in web_ui just prepare a document of the correct object structure and then have the templates do all of the rendering. With a good object structure most information could be extracted using member functions and attributes. Having a good object structure would contribute for a better structure, better readability, maintainability and less code duplication. What do you think? Regards, Peter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/trac-dev?hl=en -~----------~----~----~----~------~----~------~--~---
