I tried to write full-up programs in XML/XSLT at work and fully agree with you that XML is by design not suitable for such task.
However, templates are not, and should not be, full-up programs. The awkward XML programing can actually remind the author to limit the logic in the template. Besides, when both the number and complexity of your templates grow, it'll be appreciated more and more that your final HTML will be well- formed (and free from XSS attack) so long as each individual template is validated. This is kind of like unit testing to me. Last but not the least, XML templates are more designer friendly than their non-XML counterparts. That's why I'm still with Genshi while waiting for Chameleon to be ready for prime time. Just another perspective. Jerry On Dec 18, 5:34 am, John Rusnak <[email protected]> wrote: > If you have ever tried full-up programming in XML or seen XML that tries to > act like a full programming language this is what the Chameleon experience > was like for me. And for me, this is not a pleasant one. XML/HTML was not > designed for programming logic, etc. Mako allows a good and balanced way > of mixing logic and HTML(formatted) text. > > Just one person's perspective. > > > > > > > > On Sat, Dec 17, 2011 at 11:14 AM, Mike Orr <[email protected]> wrote: > > On Sat, Dec 17, 2011 at 5:28 AM, Joshua Partogi > > <[email protected]> wrote: > > > Hi there, > > > > I am left undecided whether to use mako or chameleon. From what I have > > > observed, it seems that chameleon is the default template language in > > > pyramid (CMIIW). Is there any case where chameleon is more preferred > > > when using pyramid? I actually like mako but I am afraid there are > > > some mako functionality that is not supported in pyramid. > > > The reason Chameleon seems first is that Pyramid's codebase is a > > direct descendant of BFG, which had Chameleon. The Pylons-like parts > > were added later, and the tutorial authors happened to be Chameleon > > users. Mako was added to Pyramid with the intention that people would > > use it, and that they *should* use it if they're more comfortable with > > it. > > > All of Mako is supported in Pyramid. Overall I'd say Mako has more > > features than Chameleon and is more flexible. However, one advantage > > of Chameleon is that, because it's an XML-based language, the template > > is guaranteed to be well-formed if the rendering doesn't raise an > > exception. (That doesn't necessarily mean the output will be > > well-formed, if your variables contain unbalanced tags and you output > > them as literals rather than the default of escaping them.) Also, it > > looks Pyramid supports internationalization better with Chameleon > > (more documentation, more built-in support). That doesn't mean you > > can't do internationalization with Mako, it just means you'd have to > > do more of the structural work yourself. (Are there any tutorials on > > this?) > > > One feature that may not be obvious if you're not using the Akhet > > scaffold, is that you can define Mako options in the INI file > > ("mako.directories = line1 line2") or at the beginning of your main > > function (``settings["mako.directories"] = [...]``). > > > I also have used Mako a lot, and have been trying out Chameleon to see > > if I might want to use it. My impression is that Chameleon's syntax is > > very different, and it takes time to map your Mako idioms to Chameleon > > equivalents. So it's only worth doing if you have time to do it > > slowly, or if your first Chameleon application requires only simple > > templates. > > > Longer term, Chris has been talking about removing both Chameleon and > > Mako from the Pyramid core, making them add-on packages > > (pyramid_chameleon and pyramid_mako). They would then be application > > dependencies like SQLAlchemy, rather than Pyramid core dependencies. > > > -- > > Mike Orr <[email protected]> > > > -- > > You received this message because you are subscribed to the Google Groups > > "pylons-discuss" 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/pylons-discuss?hl=en. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en.
