Tried to set, didn't work. In source code of page my template code wrap into tag pre.
вторник, 28 августа 2012 г., 18:12:57 UTC+4 пользователь Primoz Anzur написал: > > Wrong content-type? > > On Tue, Aug 28, 2012 at 3:33 PM, Aleksandr Rozhkov > <aaro...@gmail.com<javascript:> > > wrote: > >> Hello, i have some problem with jinja2 render. Browser shows up template >> file source with substituted values. There is my code.py: >> ----------------------------------------------------------- >> import os >> import web >> import jinja2 >> from web import form >> >> jaja = >> jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__),'templates'))) >> login = form.Form( >> form.Textbox('username', description = 'Ваше имя', id = 'username'), >> form.Password('password'), >> form.Button('login'), >> ) >> >> urls = ( >> '/.*', 'index' >> ) >> form >> class index: >> def GET(self): >> template = jaja.get_template('index.html') >> values = {'frm' : login.render(), 'name' : 'sasdasddfsdf'} >> return template.render(values) >> def POST(self): >> i = web.input() >> text = '%s, you login with password %s' % (i.username, i.password) >> return text >> >> if __name__ == "__main__": >> app = web.application(urls,globals()) >> app.run() >> ------------------------------------------------------ >> And there is template index.html: >> --------------------------------------------------------- >> <!DOCTYPE html> >> <html> >> <title>Login!</title> >> <center> >> <form method="POST"> >> {{frm}} >> {{ name }} >> </form> >> </center> >> </html> >> -------------------------------------------------------- >> Where is my mistake? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "web.py" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/webpy/-/PQTPTf90jcoJ. >> To post to this group, send email to we...@googlegroups.com <javascript:> >> . >> To unsubscribe from this group, send email to >> webpy+un...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/webpy?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "web.py" group. To view this discussion on the web visit https://groups.google.com/d/msg/webpy/-/qrq98SKf8nQJ. To post to this group, send email to webpy@googlegroups.com. To unsubscribe from this group, send email to webpy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.