From: Jaroslav G. <j_g...@ya...> - 2001-02-12 09:53:02
|
> >***template.py*** > >out.write(""" > ><html> > ><head> > ><title>Test</title> > ></head> > ><body> > ><h1>Test</h1> > >""") > >out.write("<p>name is {" + foo.name + " }\n") > >out.write(""" > ></body> > ></html> > >""") > >***end sources*** > > Don't embed. > Try using the % operator for strings: > > "<p>name is {%s }\n")" % foo.name Whole application framework is written in Java, only templates are written in python (Jython) and use Java classes. A particular template can very differ from the one I sent as an example. I know '%' python operator, but it definitely does not solve the preformance problem. I think the performance problem is related to embedding not to string manipulation. Consider a 'template' to be something like JSP (Java Server Page) - it contains mainly markup code plus some jython scripting. And this template should be dynamically interpreted - in order to be able dynamically modify templates during the application runtime, (without re-compilation penalty which is significant for JSPs) Regards Jaroslav Gergic ===== Jaroslav Gergic (Gergi) mailto:j_g...@ya... http://nenya.ms.mff.cuni.cz/~gergic/ __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/ |