return render(example,context={'rows':rows}, delimiters="{{ }}")

Also does not work..

On Sat, Apr 13, 2019 at 5:47 PM Kevin Keller <keller...@gmail.com> wrote:

> I only get the h1 Hello World in the browser, but I struggle to pass over
> values to the templates with yatl
>
> is context=(rows=rows) the correct way?
>
> See the last return statement.
>
> The print command outputs "Chair" as expected.
>
> The HTML file should output
>
> Hello! Chair
>
>
>
> from flask import Flask
> from yatl import render, SPAN
> app = Flask(__name__)
>
> from pydal import DAL, Field
> db = DAL('sqlite://storage.db')
> db.define_table('thing', Field('name'))
> db.thing.insert(name='Chair')
> query = db.thing.name.startswith('C')
> db.commit()
>
>
> @app.route('/')
> def hello():
>     db._adapter.reconnect()
>     rows = db(query).select()
>     db._adapter.close()
>     example = """
> <div>
> <h1> hello! {{rows[0].name}} </h1>
> {{ pass }}
> </div>
> """
>     print (rows[0].name)
>     return render(example,context=dict(rows=rows), delimiters="{{ }}")
>
> app.run(host='0.0.0.0',use_reloader=False)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to