Opened 6 years ago

Last modified 7 days ago

#7977 new defect

AccountManager plugin does not work

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


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.


    old new  
    7979        self._notify('verify', username, token=token)
    8181    # IAnnouncementSubscriber interface
    82     def subscriptions(self, event):
    83         if event.realm == 'acct_mgr':
    84             for subscriber in self._get_membership(event):
    85                 self.log.debug("AccountManagerAnnouncement added '%s " \
    86                         "(%s)'", subscriber[1], subscriber[2])
    87                 yield subscriber
    8982    def matches(self, event):
    90         yield
     83        if event.realm != 'acct_mgr':
     84            return
     86        for subscriber in self._get_membership(event):
     87            self.log.debug("AccountManagerAnnouncement added '%s " \
     88                "(%s)'", subscriber[2], subscriber[3])
     89            yield subscriber
    9291    def description(self):
    93         return 'notify me an account changes NOT IMPLEMENTED'
     92        return
     94    def requires_authentication(self):
     95        return True
    9597    # IAnnouncementFormatter interface
    9698    def styles(self, transport, realm):
    155157            for result in settings[event.category].get_subscriptions():
    156158                yield result
    157159        elif event.category in ('verify', 'reset'):
    158             yield ('email', event.username, True, None)
     160            yield (self.__class__.__name__, 'email', event.username, True, None, 'text/plain', 1, 'always')
    160162    def _format_plaintext(self, event):
    161163        acct_templates = {

Attachments (0)

Change History (11)

comment:1 Changed 6 years ago 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.

comment:2 follow-up: Changed 6 years ago 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.

comment:3 in reply to: ↑ 2 Changed 4 years ago by hasienda

  • Cc rjollos doki_pen added; anonymous removed
  • Keywords acct_mgr subscriber added
  • Owner changed from doki_pen to hasienda
  • Severity changed from normal to major

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.

comment:4 Changed 4 years ago 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.

comment:5 Changed 4 years ago 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.

comment:6 Changed 4 years ago 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.

comment:7 Changed 4 years ago 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.

comment:8 Changed 4 years ago 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.

comment:9 Changed 4 years ago by rjollos

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

comment:10 Changed 4 years ago 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.

comment:11 Changed 7 days ago by rjollos

  • Owner hasienda deleted

Add Comment

Modify Ticket

as new The ticket will remain with no owner.

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

Note: See TracTickets for help on using tickets.