Ticket #7977 (new defect)

Opened 3 years ago

Last modified 5 months ago

AccountManager plugin does not work

Reported by: anonymous Assigned to: hasienda
Priority: normal Component: AnnouncerPlugin
Severity: major Keywords: acct_mgr subscriber
Cc: rjollos, doki_pen Trac Release: 0.12

Description

This diff against r9174, along with resolving the issues in #7974 and #7976, gets us an AccountManager plugin that will at least respond to password resets.

--- announce.py.orig	2010-09-28 02:35:58.000000000 +0000
+++ announce.py	2010-11-03 00:49:18.000000000 +0000
@@ -79,18 +79,20 @@
         self._notify('verify', username, token=token)
 
     # IAnnouncementSubscriber interface
-    def subscriptions(self, event):
-        if event.realm == 'acct_mgr':
-            for subscriber in self._get_membership(event):
-                self.log.debug("AccountManagerAnnouncement added '%s " \
-                        "(%s)'", subscriber[1], subscriber[2])
-                yield subscriber
-
     def matches(self, event):
-        yield
+        if event.realm != 'acct_mgr':
+            return
+        
+        for subscriber in self._get_membership(event):
+            self.log.debug("AccountManagerAnnouncement added '%s " \
+                "(%s)'", subscriber[2], subscriber[3])
+            yield subscriber
 
     def description(self):
-        return 'notify me an account changes NOT IMPLEMENTED'
+        return
+
+    def requires_authentication(self):
+        return True
 
     # IAnnouncementFormatter interface
     def styles(self, transport, realm):
@@ -155,7 +157,7 @@
             for result in settings[event.category].get_subscriptions():
                 yield result
         elif event.category in ('verify', 'reset'):
-            yield ('email', event.username, True, None)
+            yield (self.__class__.__name__, 'email', event.username, True, None, 'text/plain', 1, 'always')
 
     def _format_plaintext(self, event):
         acct_templates = {

Attachments

Change History

11/03/10 02:12:40 changed by anonymous

Oh, I forgot to mention in the description that this also requires filter_exception_realms = acct_mgr in the [announcer] section of trac.ini or the announcements will just get filtered out if default filtering is enabled.

(follow-up: ↓ 3 ) 11/09/10 18:37:50 changed by doki_pen

Thanks. The accountmanager plugin definitely needs some love. I was hoping to get it started and have it taken over by someone else. I'll definitely show it some love in the coming months.

(in reply to: ↑ 2 ) 10/21/12 13:45:39 changed by hasienda

  • cc set to rjollos, doki_pen.
  • owner changed from doki_pen to hasienda.
  • severity changed from normal to major.
  • keywords set to acct_mgr subscriber.

Replying to doki_pen:

Thanks. The accountmanager plugin definitely needs some love. I was hoping to get it started and have it taken over by someone else. I'll definitely show it some love in the coming months.

Hm, seems like in reality it went quite the other way-round, right?

As a matter of fact after much work on AccountManagerPlugin I'm here to bring this plugin on level. Thanks for the report and substantial hints on how to fix this issue. After re-working parts of the database code it should be easy to resolve this issue. Thanks for your patience until then.

11/08/12 00:57:22 changed by hasienda

(In [12309]) TracAnnouncer: Implement unused filter_exception_realms option, refs #7976 and #7977.

The chosen implementation should be slightly more efficient than what has been proposed in #7976, but I agree, that this is a pre-reqisite for making some subscribers effective, i.e. AccountManagerPlugin notifications.

11/08/12 01:45:35 changed by hasienda

(In [12312]) TracAnnouncer: Update AccountManagerPlugin messaging support, refs #7759, #7977, #8740, #8927, #9090 and #9204.

This long-standing regression is fixed now, while associated message templates are rather bare-bone ones yet and formatting could be improved significantly.

11/09/12 01:17:52 changed by hasienda

(In [12325]) TracAnnouncer: Fix generator, that was broken by [12309], refs #7759, #7976, #7977, #8740, #8927, #9090 and #9204.

And the same bad filter code even got replicated in [12312]. Sorry for not checking compiler errors earlier. Finally I discovered an UnboundLocalError for resource_id hidden behind the first error. Obviously unit tests are a blessing and needed here too.

11/09/12 23:38:00 changed by hasienda

(In [12331]) TracAnnouncer: Really fix filter now, refs #7759, #7976, #7977, #8740, #8927, #9090 and #9204.

Complete the change from [12325] to get expected behavior, or filters would be applied undesirably.

11/11/12 23:36:32 changed by hasienda

(In [12342]) TracAnnouncer: Add 'acct_mgr' as default for 'filter_exception_realms' option, refs #7759, #7976, #7977, #8740, #8927, #9090 and #9204.

IMHO this is required for better plugin usability, making AccountManagerPlugin notifications pass without additional configuration effort now.

Some Python doc-string tweaks and another unit test slipped in here too.

11/15/12 01:13:44 changed by rjollos

(In [12353]) Refs #7759, #7976, #7977, #8740, #8927, #9090 and #9204: Fixed minor syntax error introduced in [12342].

01/02/13 21:37:30 changed by hasienda

(In [12503]) AnnouncerPlugin: Extend AccountManager notifications as required, refs #843, #7759 and #7977.

Note, that any previous version of TracAnnouncer won't work with latest AccountManagerPlugin 'trunk' code, and this already made me thinking about a more robust change listener definition. But this is another subject.


Add/Change #7977 (AccountManager plugin does not work)




Change Properties
Action