FedericoCeratto/bottle-cork

Registration email fails if TEMPLATE_PATH is not /views/

Closed this issue · 2 comments

I'm trying to get registration emails sent, and have set my (bottle) template path to be 'Users/me/bottle/project/views/'.

When I test login I get a 500 error - 'views/registration_email.tpl' not found.

I notice in BaseCork.register you've defaulted the email_template to 'views/register_email.tpl'.

I've moved the .tpl file to a folder under the working directory, ./views but I'd rather it was kept under /project/views. Is there a way to avoid this?

You can pass in the directory of your choice. When you call register, do so like this:

aaa.register(post_get('username'), 
             post_get('password'), 
             post_get('email_address'),
             email_template='Users/me/bottle/project/views/')

You can override the email_template by passing your own in.

@TomKealy email_template is documented in http://cork.firelet.net/cork_module.html

(Suggestions on how to improve the doc are welcome)