Wrong content-type?
On Tue, Aug 28, 2012 at 3:33 PM, Aleksandr Rozhkov <[email protected]>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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.