Wrong content-type? On Tue, Aug 28, 2012 at 3:33 PM, Aleksandr Rozhkov <aarozh...@gmail.com>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 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. > > -- You received this message because you are subscribed to the Google Groups "web.py" group. 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.