Hi Peter, thanks for your help.
I just realized that the current implementation of MailPlugin is still working with Trac 1.1.6 (probably there was some changes in the configuration of our mail server). So I have no need to change the implementation right now. But as a reminder, I created a new ticket for MailPlugin [1] with my tries to get it work with the new notification API - I haven't got it working in half a day, so I leave it currently as is. Nevertheless thank you for your support, Franz [1] https://trac-hacks.org/ticket/12518 On Thursday, September 17, 2015 at 7:55:32 AM UTC+2, Peter Suter wrote: > > On 17.09.2015 07:02, Franz wrote: > > > > On Wednesday, September 16, 2015 at 5:56:48 PM UTC+2, RjOllos wrote: > > That's the recommended way to customize the template. > > > > What problem are you encountering? > > > > > > Well, the point is that I reoworked my plugin, so that it is working > > with Trac 1.1.6 API. I also use a template file for generating email > > content as Trac does. This means at the moment, that I have to change my > > API to the new Trac API except of generating email content. After the > > deprecated code is removed, I have to rework my plugin again. > > > > It would have been better, when the new API has a method generating > > email content using the template file; of course it could use the > > deprecated code as long as it exists and works. > > Could you explain a bit more what functionality or code from Trac you > would like to be able to reuse or call and what functionality you are > trying to replace? > > The assumption was that plugins either want to format the entire email > (so they implement INotificationFormatter) or they don't care about the > formatting at all (so they don't implement INotificationFormatter). > > What other scenario is there? > > I looked briefly at XMailTicketNotify[1] and timed_email.txt[2] and it > seems it formats the entire email itself and needs (almost?) no help > from Trac. > > Is it just the templating part? In that case you may be better off to > just copy it to your plugin. I assume this would be all you need: > {{{ > template = Chrome(self.env).load_template(template_name, method='text') > data = Chrome(self.env).populate_data(None, {'CRLF': CRLF}) > # ... add more stuff to data here ... > stream = template.generate(**data) > t = deactivate() > try: > return stream.render('text', encoding='utf-8') > finally: > reactivate(t) > }}} > > But maybe I'm missing something. > > [1] > https://trac-hacks.org/browser/mailplugin/trunk/xmail/XMailEMailModule.py > [2] > > https://trac-hacks.org/browser/mailplugin/trunk/xmail/templates/timed_email.txt > > > -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/trac-dev. For more options, visit https://groups.google.com/d/optout.
