#90 closed enhancement (fixed)
[Patch] eMail with 'alternate_notify_template' after creation does not work
Reported by: | hju@… | Owned by: | bas |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | email2trac | Version: | 0.3 |
Keywords: | Cc: | mor@… |
Description
I tried to use a modified copie of /usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/ticket/templates/ticket_notify_email.txt as template for the initial notification to the reporter. This copy is placed in the same directory an specified in email2trac.conf
project: /home/trac/ticket debug: 1 umask: 022 spam_level: 5 reply_all : 0 mailto_link: 0 umask: 022 email_header: 0 trac_version: 0.11 enable_syslog: 1 alternate_notify_template: new_notify.txt drop_spam: 0 verbatim_format: 0 strip_signature: 1 email_quote: > strip_quotes: 1 ignore_trac_user_settings: 0 ticket_update: 1 blacklist: MAILER-DAEMON@
Trac-notification and reporter-notification is enabled, but always ticket_notify_email.txt is used as template.
[notification] always_notify_owner = true always_notify_reporter = true always_notify_updater = false mime_encoding = base64 nevernotifyupdater = true reporter_states = new,closed,reopened smtp_always_bcc = hju@jochenkuhl.de smtp_always_cc = smtp_default_domain = smtp_enabled = true ...
I've browsed the source to find the clue, but I found no bug. As I anderstood, the "standard-process" of notification is used to get_recipients. Therefore it is no additional notification sent but the replacement of the normal notification depending on the settings for notification (means: if always_notify_reporter = false there will never be a notification send to reporter.
Did I miss anything in the manual?
Is there any hidden option to enable it?
Attachments (0)
Change History (7)
comment:1 Changed 15 years ago by bas
- Status changed from new to assigned
comment:2 Changed 15 years ago by hju@…
- Cc mor@… added
Can do not see any big changes between the versions.
Neither do I. The only "big" change in this case is from ClearSilver .cs to Genshi...
Does your alternate template work for the web interface submission.
I'm not shure if I get the point. The alternate_notify_template is only adressed by email2trac not by the web interface. If youe mean if the template it self is buggy, I can ashure that it works fine...
Did you tried to specifiy the full path to the template?
Indeed I did. No effect, sorry.
We found out a "quick hack" or workaround, which is no real solution but make it work anyway for now:
in /trac/notification.py Insert in
def notify(self, resid):
...
from trac.web.chrome import Chrome
self.template = Chrome(self.env).load_template(self.template_name, method='text')
...
(torcpts, ccrcpts) = self.get_recipients(resid)
to force loading the template after changing the template_name. Changing this base-class is no valid solution I think. But it shows the path to the problem...
Nevertheless, this is no explanation for the differen behaviour betwenn 0.10 and 0.11.
Furthermore we have split the templates for new and updates tickets.
comment:3 Changed 15 years ago by bas
- Type changed from defect to enhancement
Maybe we can use the same approach in email2trac, pseudo code:
tn = TicketNotifyEmail(self.env) self.template = Chrome(self.env).load_template(self.template_name, method='text') tn.notify(tkt, new, modtime)
For now there is no difference between new and update. Maybe a solution would be to have two email address one for ticket submission and one for the replies or adding an extra option to email2trac.conf
comment:4 Changed 15 years ago by hju@…
That`s what we would try next.
At the moment we have a hard-coded selection.
I look foreward for a more generic solution.
First I think of a different template for new tickets and for updates (alternate_notify_new_ticket and alternate_notify_update_ticket). Selection may be done in email2trac.py.in.notify() depending on new=true or new=false.
Next I think for different possible templates depending on the current state of the ticket... (A different template may be handy updating a closed ticket rather than an accepted ticket).
Perhaps here we are back again connecting workflow actions... but this will b a third step.
comment:5 Changed 15 years ago by hju@…
- Summary changed from eMail with 'alternate_notify_template' after creation does not work to [Patch] eMail with 'alternate_notify_template' after creation does not work
Here the hack transfered to email2trac and the hard-coded selection between templates we have done:
-
/
old new 956 956 tn = TicketNotifyEmail(self.env) 957 957 958 958 if self.notify_template: 959 from trac.web.chrome import Chrome 960 959 961 tn.template_name = self.notify_template; 962 if not new: 963 tn.template_name += ".update" 964 965 tn.template = Chrome(tn.env).load_template(tn.template_name, method='text') 960 966 961 967 tn.notify(tkt, new, modtime) 962 968 ticket_prefix = 'default'
We are using two templates
- name.txt
- name.txt.update
which works for now.
comment:6 Changed 15 years ago by bas
Thanks for the patch. I will modify it a bit so it also works for trac 0,10. Mabye we have to add an option that id set uses the same template name with .update appended to it.
comment:7 Changed 15 years ago by bas
- Resolution set to fixed
- Status changed from assigned to closed
Applied to trunk with some modifications:
- added alternate_notify_template_update config option
So it can be closed
No this feature was added for trac 0.10, maybe it works different in 0,11. Can do not see any big changes between the versions. Does your alternate template work for the web interface submission. Did you tried to specifiy the full path to the template?