Modify

Opened 15 years ago

#5501 new enhancement

Using email from django for announcer plugin

Reported by: jug Owned by: Waylan Limberg
Priority: normal Component: DjangoAuthIntegration
Severity: normal Keywords: django auth email announcerplugin
Cc: Trac Release: 0.11

Description

Add the following to the plugin and enable it in trac.ini (or WebAdmin) to get the AnnouncerPlugin using email addresses from your django db.

from announcerplugin.api import IAnnouncementAddressResolver
    
class DjangoEmailResolver(Component):
    implements(IAnnouncementAddressResolver)
        
    def get_address_for_name(self, name, authenticated):
        settings = self.config.get('djangoauth', 'django_settings_module')
        os.environ['DJANGO_SETTINGS_MODULE'] = settings
        from django.contrib.auth.models import User
        try:
            user = User.objects.get(username=name)
            return user.email
        except User.DoesNotExist:
            return None

Attachments (0)

Change History (0)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Waylan Limberg.

Add Comment


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

 
Note: See TracTickets for help on using tickets.