On 14 Aug 2012, at 5:35 AM, Anthony <abasta...@gmail.com> wrote: > auth,messages.verify_email = ('Here I put my very long html code' > 'I can write texts ' > 'I can put a tutorial ' > 'I can put an user agreement' > 'ans so.... the final link' > ' Click on the link' > ' http://%(host)s/%(url)s/%(key)s > ' > " to verify your email') > > or even... > > > auth,messages.verify_email = template.render("my_verify_email_template.html", > {"mycontext": "myvalues"}) > > But can't you already do either of the above? As long as the resulting string > includes "%(key)s" somewhere, the current setup should work fine, no? In the > first case, for example, you could do: > > auth.messages.verify_email = '''here I put my very long html code > I can write text > I can put a tutorial > and so...the final link > Click on the link > http://%(host)s/%(url)s/%%(key)s > to verify your email''' % dict(host='mysite.com', > url='default/user/verify_email') > > Which will yield: > > 'here I put my very long html code\nI can write text\nI can put a > tutorial\nand so...the final link\nClick on the > link\nhttp://mysite.com/default/user/verify_email/%(key)s\nto verify your > email' > > which includes "%(key)s", which will be filled in by the register function. >
With Python 2.6+, you can also use str.format() to provide a second level of interpolation that's independent of %-interpolation. http://docs.python.org/library/stdtypes.html#str.format --