Hello Cisco,
I tried this here and it seems to work.
============= main file ==================
import web
render = web.template.render('templates/')
urls = ('/', 'index')
app = web.application(urls, globals())
class index:
def GET(self):
return render.templator_test()
if __name__=="__main__":
web.internalerror = web.debugerror
app.run()
==========================================
=========== templator_test.html file=====
toto<BR/>
$code:
def foo():
return 'Foo return'
def bar():
return 'Bar return'
$foo()<BR/>
$bar()<BR/>
tagada<BR/>
==========================================
the result:
=================================
toto
Foo return
Bar return
tagada
=================================
How do you declare your "render" object ?
Regards,
Christophe.
Le 24/07/2015 18:47, Cisco Zabala (MakerBro) a écrit :
Can I have multiple function definitions inside a single code block
($code:)? For example:
|
$code:
deffoo():
return'foo'
defbar():
return'bar'
|
This obviously doesn't work, the def bar portion gets printed, but I'm
wondering if there's a proper way.
--
You received this message because you are subscribed to the Google
Groups "web.py" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.