Modify

Opened 14 years ago

Closed 8 years ago

Last modified 8 years ago

#7977 closed defect (fixed)

AccountManager plugin does not work

Reported by: anonymous Owned by: Steffen Hoffmann
Priority: normal Component: AnnouncerPlugin
Severity: major Keywords: acct_mgr subscriber
Cc: Ryan J Ollos, Robert Corsaro 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

    old new  
    7979        self._notify('verify', username, token=token)
    8080
    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
    88 
    8982    def matches(self, event):
    90         yield
     83        if event.realm != 'acct_mgr':
     84            return
     85       
     86        for subscriber in self._get_membership(event):
     87            self.log.debug("AccountManagerAnnouncement added '%s " \
     88                "(%s)'", subscriber[2], subscriber[3])
     89            yield subscriber
    9190
    9291    def description(self):
    93         return 'notify me an account changes NOT IMPLEMENTED'
     92        return
     93
     94    def requires_authentication(self):
     95        return True
    9496
    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')
    159161
    160162    def _format_plaintext(self, event):
    161163        acct_templates = {

Attachments (0)

Change History (13)

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

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 12 years ago by Steffen Hoffmann

Cc: Ryan J Ollos Robert Corsaro added; anonymous removed
Keywords: acct_mgr subscriber added
Owner: changed from Robert Corsaro to Steffen Hoffmann
Severity: normalmajor

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 12 years ago by Steffen Hoffmann

(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 12 years ago by Steffen Hoffmann

(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 12 years ago by Steffen Hoffmann

(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 12 years ago by Steffen Hoffmann

(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 12 years ago by Steffen Hoffmann

(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 12 years ago by Ryan J Ollos

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

comment:10 Changed 12 years ago by Steffen Hoffmann

(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 8 years ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

comment:12 Changed 8 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

comment:13 Changed 8 years ago by Ryan J Ollos

Owner: set to Steffen Hoffmann

Modify Ticket

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