Modify

Opened 5 years ago

Last modified 3 years ago

#4895 new defect

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

Reported by: anonymous Owned by: hasienda
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords: change notification
Cc: kspraggs@…, 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 (1)

0001-updates-notification.py-for-trac-0.12-compatibility.patch (1.7 KB) - added by doki_pen 4 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 5 years ago 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'

comment:2 Changed 5 years ago by anonymous

  • Cc kspraggs@… added

comment:3 Changed 5 years ago by anonymous

  • Cc JamesMills added

comment:4 follow-up: Changed 5 years ago by bebugz@…

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.

comment:5 in reply to: ↑ 4 Changed 5 years ago 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 ?

comment:7 Changed 4 years ago by mitsu@…

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.

comment:8 Changed 4 years ago by mario.fetka@…

thx for the fix
is it already included in svn

comment:9 Changed 4 years ago by piotr@…

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

I need it as well :)

comment:10 follow-up: Changed 4 years ago by doki_pen

  • Keywords patch added
  • 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?

comment:11 Changed 4 years ago by pacopablo

  • Owner changed from mgood to pacopablo
  • Status changed from new to assigned

comment:12 Changed 4 years ago by pacopablo

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:13 in reply to: ↑ 10 Changed 3 years ago by hasienda

  • Keywords change notification added; patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Trac Release changed from 0.12 to 0.11

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.

comment:14 Changed 3 years ago by hasienda

  • Owner changed from pacopablo to hasienda
  • Status changed from reopened to new

comment:15 Changed 3 years ago by hasienda

Closed #8338 as a duplicate of this issue.

comment:16 Changed 3 years ago 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 Comment

Modify Ticket

Action
as new .
Author


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

 
Note: See TracTickets for help on using tickets.