Ticket #4895 (new defect)

Opened 4 years ago

Last modified 2 years ago

[patch] AccountManagerPlugin + Trac 0.12 (no attribute smtp_server)

Reported by: anonymous Assigned to: hasienda
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords: change notification
Cc: kspraggs@cardet.com, JamesMills Trac Release: 0.11

Description

I'm aware that 0.12 isn't supported yet but the only feature that doesn't work is sending e-mails. I get the following:

AttributeError: 'AccountChangeNotification' object has no attribute 'smtp_server'

I'm a software engineer but have no experience with Python. If anyone could point me in the right direction I'm sure I could fix the issue.

Thanks,

SpiffyJr?

Attachments

0001-updates-notification.py-for-trac-0.12-compatibility.patch (1.7 kB) - added by doki_pen on 02/26/10 03:22:43.

Change History

04/07/09 21:25:33 changed by anonymous

Log output:

[825Tech log]# cat trac.log

2009-04-07 14:24:37,246 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Trac-0.12multirepos_r7987-py2.5.egg/trac/web/main.py", line 459, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.5/site-packages/Trac-0.12multirepos_r7987-py2.5.egg/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 397, in process_request
    _create_user(req, self.env)
  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 70, in _create_user
    mgr.set_password(user, password)
  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 129, in set_password
    self._notify('created', user, password)
  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 238, in _notify
    getattr(l, func)(*args)
  File "build/bdist.linux-i686/egg/acct_mgr/notification.py", line 41, in user_created
    notifier.notify(username, 'New user registration')
  File "build/bdist.linux-i686/egg/acct_mgr/notification.py", line 79, in notify
    NotifyEmail.notify(self, username, subject)
  File "/usr/lib/python2.5/site-packages/Trac-0.12multirepos_r7987-py2.5.egg/trac/notification.py", line 328, in notify
    Notify.notify(self, resid)
  File "/usr/lib/python2.5/site-packages/Trac-0.12multirepos_r7987-py2.5.egg/trac/notification.py", line 226, in notify
    self.send(torcpts, ccrcpts)
  File "build/bdist.linux-i686/egg/acct_mgr/notification.py", line 149, in send
    % (self.smtp_server, self.smtp_port, recipients))
AttributeError: 'AccountChangeNotification' object has no attribute 'smtp_server'

04/07/09 21:42:13 changed by anonymous

  • cc set to kspraggs@cardet.com.

04/24/09 01:28:48 changed by anonymous

  • cc changed from kspraggs@cardet.com to kspraggs@cardet.com, JamesMills.

(follow-up: ↓ 5 ) 05/20/09 14:02:55 changed by bebugz@gmail.com

It seems that NotifyEmail? class from trac.notification has lost several properties and this Account Manager notification.py hasn't been changed yet.

As a very hotfix you can modify 149 line and exclude missing properties to:

 self.env.log.info("Sending SMTP notification to %s"
                           % (recipients))

This is something related to logging activities and I don't need that at beta build.

Second change will be to comment out

        #self.server.sendmail(msg['From'], recipients, msgtext)

This is notification about account creation.

At lease these changes will allow you to use account manager without email notifications.

Going forward you can try to make the actual change from self.server.sendmail... to something like self.notify... etc.

(in reply to: ↑ 4 ) 12/26/09 18:44:50 changed by anonymous

Replying to bebugz@gmail.com:

This is notification about account creation. At lease these changes will allow you to use account manager without email notifications. Going forward you can try to make the actual change from self.server.sendmail... to something like self.notify... etc.

is there already a propper patch for this problem. so that notification works again ?

02/17/10 10:51:58 changed by mitsu@syntheticzero.com

Here's a fix:

To notification.py, add at the beginning:

from trac.notification import NotificationSystem

and replace

self.server.sendmail(msg['From'], recipients, msgtext)

with

NotificationSystem(self.env).send_email(msg['From'], recipients, msgtext)

That seems to fix it.

02/17/10 14:14:01 changed by mario.fetka@gmail.com

thx for the fix is it already included in svn

02/18/10 13:27:03 changed by piotr@ucs.no

In what SVN? As far as I can tell, it has not been commited to trac-hacks SVN...

I need it as well :)

02/26/10 03:22:43 changed by doki_pen

  • attachment 0001-updates-notification.py-for-trac-0.12-compatibility.patch added.

(follow-up: ↓ 13 ) 02/26/10 03:24:20 changed by doki_pen

  • keywords set to patch.
  • summary changed from AccountManagerPlugin + Trac 0.12 (no attribute smtp_server) to [patch] AccountManagerPlugin + Trac 0.12 (no attribute smtp_server).

The attached patch fixes AccountManager for trac-0.12. I'm pretty sure this will break 0.11. AccountManager appears to work well in 0.12, with this patch, so maybe it's time for a 0.12 branch?

02/26/10 03:26:34 changed by pacopablo

  • owner changed from mgood to pacopablo.
  • status changed from new to assigned.

02/27/10 07:54:11 changed by pacopablo

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7737]) Patch from doki_pen. Fixes #4895

(in reply to: ↑ 10 ) 07/25/11 14:29:52 changed by hasienda

  • release changed from 0.12 to 0.11.
  • status changed from closed to reopened.
  • resolution deleted.
  • keywords changed from patch to change notification.

Replying to doki_pen:

[...] I'm pretty sure this will break 0.11. AccountManager appears to work well in 0.12, with this patch, so maybe it's time for a 0.12 branch?

Bad news for me, since current code is still meant to be compatible with Trac 0.11, so I'll reopen this issue for the old Trac release, just as a reminder, to check this and possibly work towards a more compatible fix.

07/25/11 14:30:41 changed by hasienda

  • status changed from reopened to new.
  • owner changed from pacopablo to hasienda.

07/25/11 15:07:50 changed by hasienda

Closed #8338 as a duplicate of this issue.

07/27/11 09:40:02 changed by hasienda

Closed #9032 as a duplicate of this issue, filed against acct_mgr-0.2.1dev-r7163 with Trac 0.11, sadly really no news.


Add/Change #4895 ([patch] AccountManagerPlugin + Trac 0.12 (no attribute smtp_server))




Change Properties
Action