Opened 17 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)
Change History (19)
comment:1 Changed 17 years ago by
comment:2 Changed 17 years ago by
| Cc: | Kyle Spraggs added; anonymous removed | 
|---|
comment:3 Changed 17 years ago by
| Cc: | James Mills added | 
|---|
comment:4 follow-up: 5 Changed 16 years ago by
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 Changed 16 years ago by
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 16 years ago by
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:9 Changed 16 years ago by
In what SVN? As far as I can tell, it has not been commited to trac-hacks SVN...
I need it as well :)
Changed 16 years ago by
| Attachment: | 0001-updates-notification.py-for-trac-0.12-compatibility.patch added | 
|---|
comment:10 follow-up: 13 Changed 16 years ago by
| 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 16 years ago by
| Owner: | changed from Matt Good to John Hampton | 
|---|---|
| Status: | new → assigned | 
comment:12 Changed 16 years ago by
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 
comment:13 follow-up: 18 Changed 14 years ago by
| Keywords: | change notification added; patch removed | 
|---|---|
| Resolution: | fixed | 
| Status: | closed → reopened | 
| Trac Release: | 0.12 → 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 14 years ago by
| Owner: | changed from John Hampton to Steffen Hoffmann | 
|---|---|
| Status: | reopened → new | 
comment:16 Changed 14 years ago by
comment:17 Changed 9 years ago by
| Owner: | Steffen Hoffmann deleted | 
|---|
comment:18 Changed 7 years ago by
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
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 




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'