AW: [Product-Developers] Re: POI Email notification

Nunner, Thomas Thomas.Nunner at joanneum.at
Tue Apr 6 11:51:14 UTC 2010


Dear Maurits,

finally Poi with your new code is running. It is doing exactly what I want, after an issue is created (only the responsible manager is notified via email). But during the creation of an issue, still all the track managers are notified via email). Also in this case only the responsible manager should be notified via email. I already tried to modify the code but without any success.

Any help would be greatly appreciated!

Thomas



-----Ursprüngliche Nachricht-----
Von: product-developers-bounces at lists.plone.org [mailto:product-developers-bounces at lists.plone.org] Im Auftrag von Maurits van Rees
Gesendet: Dienstag, 30. März 2010 14:44
An: product-developers at lists.plone.org
Betreff: [Product-Developers] Re: POI Email notification

Hi Thomas,

Please keep the discussion on the list, thanks.

Op 30-03-10 09:46, Nunner, Thomas schreef:
 > I am using Plone 3 and Poi 1.2.8. I had a look at the code but do not fully understand it. As far as I understand it, in Products/Poi/content/PoiTracker.py the responsible person ist not specified but in Products/Poi/content/PoiIssue.py it is.
 > Can you give me some more hints of how to change the code?

Something like this in PoiTracker.py in the getNotificationEmailAddresses method should do the trick (untested):


=========================================================================
   if not self.getSendNotificationEmails():
       return []

   portal_membership = getToolByName(self, 'portal_membership')

   member = portal_membership.getAuthenticatedMember()
   email = member.getProperty('email')

   # make sure no duplicates are added
   addresses = sets.Set()

   mailingList = self.getMailingList()
   if mailingList:
       addresses.add(mailingList)
   else:
       addresses.union_update([self._getMemberEmail(x, portal_membership)
                               for x in self.getManagers() or []])

   if issue is not None:
       ####### BEGINNING OF EXTRA CODE
       manager = issue.getResponsibleManager()
       if manager:
           # Empty the current addresses.
           addresses = sets.Set()
           addresses.add(self._getMemberEmail(manager, portal_membership)
       ####### END OF EXTRA CODE
       addresses.add(issue.getContactEmail())
       addresses.union_update([self._getMemberEmail(x, portal_membership)
                               for x in issue.getWatchers() or []])

   addresses.discard(None)
   addresses.discard(email)

   return tuple(addresses)
=========================================================================

Of course, changing the code of Poi directly is not recommended.  A 
monkey patch in a package of your own would be better, so you do not 
have to make the same change again by hand once version 1.2.9 comes out. 
  But changing the code directly may be the fastest.

Maurits



_______________________________________________
Product-Developers mailing list
Product-Developers at lists.plone.org
http://lists.plone.org/mailman/listinfo/product-developers




More information about the Product-Developers mailing list