def foo(): ... ret = dict(...) if email_required: html = response.render(ret) ... # send html by email return html return ret --
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/kb42uKUVs6E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/da397328-7304-49f7-a6a6-c9588f54d8ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#pretty decorator
def with_email_to(addr): def inner(f): def emailer(): ret = f()
html = response.render(ret) ... # send html to addr by email return html return emailer
On Thursday, June 20, 2019 at 8:39:45 PM UTC+3, Val K wrote:I mean the following logic:def foo(): ... ret = dict(...) if email_required: html = response.render(ret) ... # send html by email return html return ret
On Thursday, June 20, 2019 at 8:26:33 PM UTC+3, Vlad wrote:I couldn't figure out how this woks, so just rendered it again. Not a big deal - just a matter of convenience. The email requests come occasionally, so this extra render doesn't cause trouble.
Thank you, Val!
On Thursday, June 20, 2019 at 6:23:55 AM UTC-4, Val K wrote:I think you can try to yield rendered view from controller just by 'return rendered_response'. If controller returns string (not dict) it will be sent as is
To unsubscribe from this group and all its topics, send an email to web...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/833e8180-b48e-44de-80db-78e91a15a4a5%40googlegroups.com.