Edgewall Software
Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12660 closed defect (fixed)

EmailDistributor.resolvers option should set to include_missing=False

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.2.1
Component: notification Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

EmailDistributor.resolvers returns only configured resolvers.

API Changes:
Internal Changes:

Description

EmailDistributor.resovlers returns all components which are implemented IEmailAddressResolver. The behavior is not useful. I consider we should use only configured resolvers.

>>> from trac.test import EnvironmentStub
>>> from trac.loader import load_components
>>> from trac.notification.mail import EmailDistributor
>>> from trac.notification.tests.mail import TestEmailAddressResolver
>>> env = EnvironmentStub()
>>> EmailDistributor(env).resolvers
[<Component trac.notification.mail.SessionEmailResolver>, <Component trac.notification.tests.mail.TestEmailAddressResolver>]

Also, another issue is that include_missing return the option's documentation string.

>>> EmailDistributor.resolvers.include_missing
'Comma seperated list of email resolver components in the order\n        they will be called.  If an email address is resolved, the remaining\n        resolvers will not be called.\n        '
  • trac/notification/mail.py

    diff --git a/trac/notification/mail.py b/trac/notification/mail.py
    index 6878fbebf..c3421eaf9 100644
    a b class EmailDistributor(Component):  
    280280    resolvers = OrderedExtensionsOption('notification',
    281281        'email_address_resolvers', IEmailAddressResolver,
    282282        'SessionEmailResolver',
    283         """Comma seperated list of email resolver components in the order
     283        include_missing=False,
     284        doc="""Comma seperated list of email resolver components in the order
    284285        they will be called.  If an email address is resolved, the remaining
    285286        resolvers will not be called.
    286287        """)

Attachments (0)

Change History (3)

comment:1 by Peter Suter, 8 years ago

Sounds good. I think this was copied from Announcer.

I'm surprised the default is include_missing=True. RequestDispatcher.filters seems to be the only other place in Trac where that default is used. I'm not sure why that is desired.

comment:2 by Jun Omae, 8 years ago

Owner: set to Jun Omae
Release Notes: modified (diff)
Status: newassigned

Thanks for the reviewing. Committed in [15354] and merged in [15355].

comment:3 by Jun Omae, 8 years ago

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.