Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12158 closed defect (fixed)

trachtmlnotificationplugin fails in Trac 1.1.3

Reported by: lukasz.matecki@… Owned by: Jun Omae
Priority: normal Component: TracHtmlNotificationPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

I'm not absolutely sure if this is about the plugin, but I'm getting the following error when I'm changing a ticket (the change succeeds):

AttributeError: 'Environment' object has no attribute 'get_db_cnx'

Attachments (2)

prefs-notifications.png (32.7 KB) - added by Jun Omae 5 years ago.
screen_2015-04-06T133304.png (55.1 KB) - added by lukasz.matecki@… 5 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 5 years ago by Jun Omae

Would you post entire of the traceback?

comment:2 Changed 5 years ago by Jun Omae

I guess that installed other plugins lead the issue in your environment. This plugin never call get_db_cnx(). See trachtmlnotificationplugin/0.12/trachtmlnotification/notification.py@13660:48-50#L48.

comment:3 Changed 5 years ago by Jun Omae

Keywords: needinfo added

comment:4 Changed 5 years ago by anonymous

I'm sorry, I didn't save it and now I cannot reproduce the problem.

But I have another issue, the notification emails are no longer "pretty printed"; somehow after 1.1.3 installation, I'm getting raw text notifications.

My configuration file has the required lines:

trachtmlnotification.* = enabled
...
email_sender = HtmlNotificationSmtpEmailSender

Any thoughts?

comment:5 Changed 5 years ago by Jun Omae

Keywords: needinfo removed

This plugin detects ticket id using X-Trac-Ticket-URL header in notification mail. However, Trac 1.1.3 doesn't generate X-Trac-Ticket-URL header. It doesn't work with Trac 1.1.3. I've filed in trac:#11926.

MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
X-Trac-Realm: ticket
From: "My Project" <trac@localhost>
X-Trac-Version: 1.1.3
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.1.3, by Edgewall Software
To: undisclosed-recipients: ;
References: <011.5820a89cc2c970d854f42757ba2afba4@localhost>
X-Trac-Project: My Project
In-Reply-To: <011.5820a89cc2c970d854f42757ba2afba4@localhost>
Date: Thu, 22 Jan 2015 04:58:51 -0000
Reply-To: trac@localhost
Message-ID: <026.95f8819ec9a6fc74629637032ed18e26@localhost>
X-URL: 
Subject: Re: [My Project] #1: test

#1: test
-------------------------+-----------------------
  Reporter:  jun66j5@…   |      Owner:  jun66j5@…
      Type:  defect      |     Status:  assigned
  Priority:  major       |  Milestone:
 Component:  component1  |    Version:
Resolution:              |   Keywords:
-------------------------+-----------------------
...

comment:6 Changed 5 years ago by Jun Omae

In 14384:

TracHtmlNotificationPlugin: added support of INotificationFormatter for Trac 1.1.3+ (refs #12158)

comment:7 in reply to:  6 Changed 5 years ago by Jun Omae

I've added support of new notification system since Trac 1.1.3 in [14384]. However, generated html mail is broken. I just reported in trac:#11927.

comment:8 Changed 5 years ago by Jun Omae

Resolution: fixed
Status: newclosed

The latest works well with Trac 1.1.4. If you want html mails with Trac 1.1.4+, please configure text/html format in your preferences.

comment:9 Changed 5 years ago by lukasz.matecki@…

Resolution: fixed
Status: closedreopened

I/ve just installed Trac 1.1.4 (http://trac.edgewall.org/wiki/TracDev/ReleaseNotes/1.1#DevelopmentRelease) and TracHtmlNotificationPlugin using easy_install http://trac-hacks.org/svn/trachtmlnotificationplugin/0.12 and I'm still unable to get html notification.

I cannot modify my notification settings. When I'm on the notification setting page, I cannot add any rule (nothing happens when i click on the Add button). After pressing add, when I try to leave the page, the browser asks something like "This page wants you to confirm you want to leave the page, since there may be unsaved data".

I also tried to use the old style configuration using trac.ini but also no luck.

The plain text notifications are sent successfully.

comment:10 in reply to:  9 Changed 5 years ago by Jun Omae

Resolution: fixed
Status: reopenedclosed

Works for me.

I cannot modify my notification settings. When I'm on the notification setting page, I cannot add any rule (nothing happens when i click on the Add button). After pressing add, when I try to leave the page, the browser asks something like "This page wants you to confirm you want to leave the page, since there may be unsaved data".

Only authenticated users can add rules. Also, changing email format requires adding rules.

I also tried to use the old style configuration using trac.ini but also no luck.

The plain text notifications are sent successfully.

If you prefer text/html format, you must get like this.

2015-04-06 17:21:16,750 Trac[mail] DEBUG: EmailDistributor is sending event as 'text/html' to: jun66j5@gmail.com

comment:11 Changed 5 years ago by anonymous

I'm using TRAC_ADMIN user when trying to change the notification settings.

My debug output is like this:

13:19:55 Trac[api] DEBUG: Adding (None [0]) for 'always' on rule  AlwaysEmailSubscriber) for (email)
13:19:55 Trac[api] DEBUG: Adding (Lukasz [1]) for 'always' on rule (TicketOwnerSubscriber) for (email)
13:19:55 Trac[mail] DEBUG: EmailDistributor has found the following formats capable of handling 'email' of 'ticket': text/html, text/plain
13:19:55 Trac[mail] DEBUG: EmailDistributor is sending event as 'text/plain' to: 
<emails>

Changed 5 years ago by Jun Omae

Attachment: prefs-notifications.png added

comment:12 Changed 5 years ago by Jun Omae

Your trac.log seems that no users prefer text/html format.

My notifications panel in the testing: attachment:prefs-notifications.png.

Changed 5 years ago by lukasz.matecki@…

comment:13 Changed 5 years ago by anonymous

I believe this may be the Trac itself and not the plugin problem.

Here is my: attachment:screen_2015-04-06T133304.png

Nothing happens when I press Add. I can also see that nothing is appended to debug when I press Add.

Here is what is appended when I press Save:

13:43:25 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/prefs/notification'">
13:43:25 Trac[api] INFO: Synchronized '(default)' repository in 0.00 seconds
13:43:25 Trac[session] DEBUG: Retrieving session for ID u'Lukasz'
13:43:25 Trac[main] DEBUG: Negotiated locale: None -> pl
13:43:25 Trac[chrome] DEBUG: Prepare chrome data for request
127.0.0.1 - - [06/Apr/2015 13:43:25] "POST /MATES/prefs/notification HTTP/1.1" 303 -
13:43:25 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/prefs/notification'">
13:43:25 Trac[api] INFO: Synchronized '(default)' repository in 0.00 seconds
13:43:25 Trac[session] DEBUG: Retrieving session for ID u'Lukasz'
13:43:25 Trac[main] DEBUG: Negotiated locale: None -> pl
13:43:25 Trac[chrome] DEBUG: Prepare chrome data for request
127.0.0.1 - - [06/Apr/2015 13:43:26] "GET /MATES/prefs/notification HTTP/1.1" 200 -
13:43:26 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/common/js/messages/pl.js'">
13:43:26 Trac[chrome] WARNING: File js/messages/pl.js not found in any of ['C:\\Users\\Lukasz\\AppData\\Roaming\\Python-
Eggs\\trac-1.1.4-py2.7.egg-tmp\\trac\\htdocs']
13:43:26 Trac[main] WARNING: [127.0.0.1] HTTPNotFound: 404 Not Found (File js/messages/pl.js not found)
13:43:26 Trac[session] DEBUG: Retrieving session for ID u'Lukasz'
13:43:26 Trac[main] DEBUG: Negotiated locale: None -> pl
13:43:26 Trac[chrome] DEBUG: Prepare chrome data for request
127.0.0.1 - - [06/Apr/2015 13:43:26] "GET /MATES/chrome/common/js/messages/pl.js HTTP/1.1" 404 -
127.0.0.1 - - [06/Apr/2015 13:44:51] "GET /MATES/login?referer=%2FMATES%2Froadmap%3Fuser%3DLukasz%26format%3Dics HTTP/1.
1" 401 -
13:44:53 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/login'">
13:44:53 Trac[api] INFO: Synchronized '(default)' repository in 0.00 seconds
13:44:53 Trac[session] DEBUG: Retrieving session for ID u'Lukasz'
127.0.0.1 - - [06/Apr/2015 13:44:53] "GET /MATES/login?referer=%2FMATES%2Froadmap%3Fuser%3DLukasz%26format%3Dics HTTP/1.
1" 302 -
13:44:53 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/roadmap'">
13:44:53 Trac[api] INFO: Synchronized '(default)' repository in 0.00 seconds
13:44:53 Trac[session] DEBUG: Retrieving session for ID u'Lukasz'
13:44:53 Trac[main] DEBUG: Negotiated locale: None -> pl
127.0.0.1 - - [06/Apr/2015 13:44:54] "GET /MATES/roadmap?user=Lukasz&format=ics HTTP/1.1" 200 -

comment:14 Changed 5 years ago by Jun Omae

First, please use force-reload since you've install new Trac. After force-reloading, check errors in your javascript console.

Anyway, I think notifications panel not working is a Trac issue.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.