scrapinghub / exporters

Exporters is an extensible export pipeline library that supports filter, transform and several sources and destinations
BSD 3-Clause "New" or "Revised" License
40 stars 10 forks source link

Notifications mail module with templating support #295

Open bbotella opened 8 years ago

bbotella commented 8 years ago

It would be nice to support a standard mail notifications module, with support for templating (maybe using jinja?).

This should be a different module than current SES notifications module, and provide a nice interface to send messages configuring proper sntp info. Templates option should support both template file path, or the template itself json formatted.

eliasdorneles commented 8 years ago

The current SES notifications module already supports jinja2, so it's okay to have it as dependency. It would be nice to do some design work before starting this new notifications module, because it's not clear to me what exactly we'd want to parameterize it.

Perhaps instead of creating a new module, we could simply change the current one, removing the coupling with SES (i.e., allowing to configure the mechanism of sending the email notification) and providing hooks for subclasses to customize the templates. :grinning:

bbotella commented 8 years ago

I like the one to fit them all approach. And, about the jinja template... What about adding the possibility of loading a text file from local disk/url?

eliasdorneles commented 8 years ago

I think YAGNI applies here. :)

As an user, I wouldn't like to have to write templates in the first place. As a developer, I would like to have complete control of how to load the template, so I can put it whenever I want.

So, it's best to start with hooks for subclasses to customize the templates, and let future usage to discover the most common and helpful cases. =)