def on_feed_exit(self, feed, config): """Send email at exit.""" config = self.prepare_config(config) if not config['active']: return # don't send mail when learning if feed.manager.options.learn: return # generate email content try: subject = render_from_feed(config['subject'], feed) except RenderError, e: log.error('Error rendering email subject: %s' % e) return
def on_feed_output(self, feed, config): # Use the default template if none is specified if not config.get('template'): config['template'] = 'default.template' filename = os.path.expanduser(config['template']) output = os.path.expanduser(config['file']) # Output to config directory if absolute path has not been specified if not os.path.isabs(output): output = os.path.join(feed.manager.config_base, output) # create the template template = render_from_feed(get_template(filename, PLUGIN_NAME), feed) log.verbose('Writing output html to %s' % output) f = open(output, 'w') f.write(template.encode('utf-8')) f.close()