Modify

Opened 16 years ago

Closed 7 years ago

#4895 closed defect (fixed)

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

Reported by: anonymous Owned by:
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords: change notification
Cc: Kyle Spraggs, James Mills 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 Robert Corsaro 15 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 16 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 16 years ago by anonymous

Cc: Kyle Spraggs added; anonymous removed

comment:3 Changed 16 years ago by anonymous

Cc: James Mills added

comment:4 Changed 16 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 15 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 15 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 15 years ago by Mario Fetka

thx for the fix is it already included in svn

comment:9 Changed 15 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 Changed 15 years ago by Robert Corsaro

Keywords: patch added
Summary: AccountManagerPlugin + Trac 0.12 (no attribute smtp_server)[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 15 years ago by John Hampton

Owner: changed from Matt Good to John Hampton
Status: newassigned

comment:12 Changed 15 years ago by John Hampton

Resolution: fixed
Status: assignedclosed

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

comment:13 in reply to:  10 ; Changed 13 years ago by Steffen Hoffmann

Keywords: change notification added; patch removed
Resolution: fixed
Status: closedreopened
Trac Release: 0.120.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 13 years ago by Steffen Hoffmann

Owner: changed from John Hampton to Steffen Hoffmann
Status: reopenednew

comment:15 Changed 13 years ago by Steffen Hoffmann

Closed #8338 as a duplicate of this issue.

comment:16 Changed 13 years ago by Steffen Hoffmann

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

comment:17 Changed 8 years ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

comment:18 in reply to:  13 Changed 7 years ago by Ryan J Ollos

Replying to Steffen Hoffmann:

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.

Trac 0.11 is no longer supported.

comment:19 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
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.