On Wednesday, April 15, 2020 at 1:35:39 PM UTC-7, Iqbal Ahmad wrote:
>
> Hi,
>
>  I am using the defalut template as mentioned in ticket_notify_email.txt and  
> also customization of email content.  My ticket_notify_email.txt looks like:
>
> $ticket_body_hdr
> --------------------------------------------------------------------------
> # set sel = ('Reporter', 'Owner', 'Type', 'Status', 'Priority', 
> 'Milestone',
>              'Component', 'Severity', 'Resolution', 'Keywords')
> # for a in ticket_props.replace('|', '\n').splitlines()[1:-1]|map('trim'):
> #   set a = a.split(':', 1)|map('trim')|list
> #   if len(a) > 1 and a[0] in sel:
> ${'%-*s  %s'|format(12, a[0] + ':', a[1])}
> #   endif
> # endfor
> --------------------------------------------------------------------------
> {% choose ticket.new %}\
> {%   when True %}\
> $ticket.description
> {%   end %}\
> {%   otherwise %}\
> {%     if changes_body %}\
> ${_('Changes (by %(author)s):', author=change.author)}
>
> $changes_body
> {%     end %}\
> {%     if changes_descr %}\
> {%       if not changes_body and not change.comment and change.author %}\
> ${_('Description changed by %(author)s:', author=change.author)}
> {%       end %}\
> $changes_descr
> --
> {%     end %}\
> {%     if change.comment %}\
>
> ${_('Comment:') if changes_body else _('Comment (by %(author)s):', 
> author=change.author)}
>
> $change.comment
> {%     end %}\
> {%   end %}\
> {% end %}\
>
> ${'-- '}
> ${_('Ticket URL: <%(link)s>', link=ticket.link)}
> $project.name <${project.url or abs_href()}>
> $project.descr
>
>
> And when I modify ticket I get the following error: 
>
> 2020-04-15 21:18:04,558 Trac[mail] DEBUG: EmailDistributor has found the 
> following formats capable of handling 'email' of 'ticket': text/plain
> 2020-04-15 21:18:04,608 Trac[mail] WARNING: EmailDistributor caught 
> exception while formatting ticket to text/plain for email: <class 
> 'trac.ticket.notification.TicketFormatter'>
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/trac/notification/mail.py", line 
> 487, in distribute
>     outputs[fmt] = formatter.format(transport, fmt, event)
>   File "/usr/lib/python2.7/site-packages/trac/ticket/notification.py", 
> line 143, in format
>     return self._format_plaintext(event)
>   File "/usr/lib/python2.7/site-packages/trac/ticket/notification.py", 
> line 248, in _format_plaintext
>     return self._format_body(data, 'ticket_notify_email.txt')
>   File "/usr/lib/python2.7/site-packages/trac/ticket/notification.py", 
> line 313, in _format_body
>     template = chrome.load_template(template_name, text=True)
>   File "/usr/lib/python2.7/site-packages/trac/web/chrome.py", line 1370, 
> in load_template
>     return self._load_jinja_template(filename, text)
>   File "/usr/lib/python2.7/site-packages/trac/web/chrome.py", line 1396, 
> in _load_jinja_template
>     return (self.jenv_text if text else self.jenv).get_template(filename)
>   File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 
> 883, in get_template
>     return self._load_template(name, self.make_globals(globals))
>   File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 
> 857, in _load_template
>     template = self.loader.load(self, name, globals)
>   File "/usr/lib64/python2.7/site-packages/jinja2/loaders.py", line 129, 
> in load
>     code = environment.compile(source, name, filename)
>   File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 
> 638, in compile
>     self.handle_exception(source=source_hint)
>   File "/usr/lib64/python2.7/site-packages/jinja2/environment.py", line 
> 832, in handle_exception
>     reraise(*rewrite_traceback_stack(source=source))
>   File "/home/TRAC/templates/ticket_notify_email.txt", line 12, in template
>     {% choose ticket.new %}\
> TemplateSyntaxError: Encountered unknown tag 'choose'.
> 2020-04-15 21:18:04,608 Trac[mail] DEBUG: EmailDistributor is sending 
> event as 'text/plain' to: xxxxxxx
> 2020-04-15 21:18:04,608 Trac[mail] WARNING: EmailDistributor cannot send 
> event 'ticket' as 'text/plain': xxxxxxx
>
> Can anyone please throw some error.  Thanks in advance.
>
> My TRAC details:
>
> PackageVersion
> Trac 1.4.1
> Genshi 0.7.3 (without speedups)
> Jinja2 2.11.1
> pysqlite 2.6.0
> Python 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red 
> Hat 4.8.5-28)]
> setuptools 46.1.3
> SQLite 3.7.17
> Subversion 1.11.1 (r1850623)
> jQuery 1.12.4
> jQuery UI 1.12.1
> jQuery Timepicker 1.6.3
>
> timingandestimationplugin 
> <http://www.trac-hacks.org/wiki/TimingAndEstimationPlugin> 1.6.0 
> /home/TRAC/plugins/timingandestimationplugin-1.6.0-py2.7.egg
> TracAccountManager <https://trac-hacks.org/wiki/AccountManagerPlugin> 
> 0.6.dev0 /usr/lib/python2.7/site-packages
> TracpathTheme <http://trac-hacks.org/wiki/TracpathTheme> 1.0.1 
> /home/TRAC/plugins/TracpathTheme-1.0.1-py2.7.egg
> TracWysiwyg <https://trac-hacks.org/wiki/TracWysiwygPlugin> 0.12.0.7 
> /usr/lib/python2.7/site-packages/TracWysiwyg-0.12.0.7-py2.7.egg
> TracXMLRPC <https://trac-hacks.org/wiki/XmlRpcPlugin> 1.1.9.dev0 
> /home/TRAC/plugins/TracXMLRPC-1.1.9dev-py2.7.egg
>
>

The default template has been updated (1). You can start with that, and 
apply the changes for Outlook (2).

(1) https://trac.edgewall.org/wiki/TracNotification#CustomizingContent
(2) https://trac.edgewall.org/wiki/CookBook/Notification/Templates#jinja2

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/efa04634-1971-46fb-8e60-e9d2bbcb840f%40googlegroups.com.

Reply via email to