simpler example i cannot interpolate this string b="<html>\r\n<body>\r\n <table >\r\n <tbody><tr >\r\n <td width='100%'>\r\n *%(a)s*\r\n
\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</body>\r\n</html>" like this b % dict(a=1) ValueError: unsupported format character *' ' '* (0x27) at index 103 2016-11-21 16:22 GMT+00:00 António Ramos <[email protected]>: > my template "see attached file" > > in the console: > response.render('templates/email_verification.html',dict(key="teststr")) > works ok > but > response.render('templates/email_verification.html') % dict(key="teststr") > does not work > i get > unsupported format character '!' (0x21) at index 615 > > this is the same behaviour as > email_body = messages.verify_email % d > so i cannot pass parameters inside the render function > verify email will interpolate it with a dict > > i already have other html emails working but the *verify_email* one is > doomed... > > any ideas? > regards > António > > 2016-11-21 13:21 GMT+00:00 Leonel Câmara <[email protected]>: > >> username is passed by auth, and it's not necessarily the "username" field >> it can be the email if you're not using an username. >> >> Basically after register if you have registration_requires_verification >> auth send an email where the body is defined as >> >> d = dict(form.vars) # form.vars holds the registration form values >> d.update(dict(key=key, link=link, username=form.vars[username])) # >> exactly what username is, is defined earlier according to your settings >> email_body = messages.verify_email % d >> >> >> You can actually build verify_email using html helpers if you aren't >> being able to do it with response.render >> >> auth.messages.verify_email = HTML( >> HEAD(), >> BODY( >> H1(T('Welcome to MY AMAZING WEBSITE' >> )), >> P(T('Click on the link below to >> check your e-mail'), ':'), >> A(URL(r=request,c='default',f='user', >> args=['verify_email'], scheme=True, host=True) + '/%(key)s ', _href=URL(r >> =request,c='default',f='user',args=['verify_email'], scheme=True, host= >> True) + '/%(key)s '), >> P(T('Thank You')), >> P(T('From MY AMAZING WEBSITE')), >> ) >> ).xml() >> >> Another alternative is to just use a string with HTML in there. >> >> -- >> 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 [email protected]. >> 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

