Edgewall Software
Modify

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#11854 closed enhancement (fixed)

Split up notification module

Reported by: Peter Suter Owned by: Peter Suter
Priority: normal Milestone: 1.1.3
Component: notification Version:
Severity: normal Keywords:
Cc: Ryan J Ollos
Release Notes:

Split up trac.notification module into a package of sub-modules.

API Changes:

Added mail notification helper functions create_charset, create_mime_text, create_header, create_message_id, and class RecipientMatcher (matches recipients taking into account admit_domains, ignore_domains, use_short_addr and smtp_default_domain config options).

Description

The Advanced Notification proposal starts with splitting up the trac/notification.py into:

  • trac/notification/api.py containing interface definitions and the NotificationSystem.
  • trac/notification/mail.py containing any email specific functionality like SmtpEmailSender and SendmailEmailSender.
  • trac/notification/compat.py containing the Notify / NotifyEmail base classes. (After #3517 these and TicketNotifyEmail would only remain for backward compatibility and could be deprecated and removed later.)

For backwards compatibility these will also be imported in trac/notification/__init__.py.

I'd also like to extract some useful pieces from NotifyEmail and TicketNotifyEmail into trac/notification/mail.py, so we can reuse them later.

The proposed changes are in log:psuter@advanced-notification-preliminary-refactorings.

Attachments (0)

Change History (7)

comment:1 Changed 4 years ago by Peter Suter

Owner: set to Peter Suter
Status: newassigned

comment:2 Changed 4 years ago by Peter Suter

API Changes: modified (diff)
Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in [13433].

comment:3 Changed 4 years ago by Ryan J Ollos

It looks like NotificationSystem has an indirect import. Any reason for that, or was it just an oversight?

  • trac/notification/__init__.py

    diff --git a/trac/notification/__init__.py b/trac/notification/__init__.py
    index 2a44766..efb9c2b 100644
    a b  
    1212# history and logs, available at http://trac.edgewall.org/log/.
    1313
    1414# Imports for backward compatibility
    15 from trac.notification.api import IEmailSender
    16 from trac.notification.compat import NotificationSystem, Notify, NotifyEmail
     15from trac.notification.api import IEmailSender, NotificationSystem
     16from trac.notification.compat import Notify, NotifyEmail
    1717from trac.notification.mail import (EMAIL_LOOKALIKE_PATTERN, MAXHEADERLEN,
    1818                                    SmtpEmailSender, SendmailEmailSender)

comment:4 Changed 4 years ago by Ryan J Ollos

Cc: Ryan J Ollos added

comment:5 in reply to:  3 Changed 4 years ago by Peter Suter

Replying to rjollos:

It looks like NotificationSystem has an indirect import. Any reason for that, or was it just an oversight?

Just an oversight. I don't recall any special intent. Please commit, thanks.

comment:6 Changed 4 years ago by Peter Suter

It seems this is from Jun's cleanup in #4056, so I might also have missed the intent.

Last edited 4 years ago by Peter Suter (previous) (diff)

comment:7 Changed 4 years ago by Ryan J Ollos

Thanks for feedback, I committed [13652].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted.
to The owner will be changed from Peter Suter 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.