I am playing around trying to make something happen on a workflow state
change. Beacause I cannot import the module I need in the python script I
am getting an error:
global name 'getMemberById' is not defined
how can I import this module or better still code this so I am not
importing anything at all (i imagine the restrictions on importing modules
was done for a reason).
#import the module we need
from Products.CMFCore.utils import getToolByName
# Get the content object we're publishing
# How can I import this module?????
#from Products.CMFDefault.MembershipTool import MembershipTool
mt = getToolByName(context, 'portal_membership')
listed_ids = mt.getRoster()
contentObject = review_state
# Start with an empty list, ready to be filled with the addressed
# of people we're dispatching to
mailhost = context.MailHost
mailhost = getattr(context, 'MailHost', None)
# Iterate through all the site's users
for id in listed_ids:
member = getMemberById(id)
email = member.getProperty('email')
# add them to the list of people we're emailing
mMsg = 'Crop notification sent'
mTo = email
# and send it
mailhost.send(mMsg, mTo, '[EMAIL PROTECTED]', 'New Crops available')
# The change in indentation signals the end of the loop, so we've
# now sent all the emails. Let's now send a confirmation that we've done it.
# We'll be building the email as a string again, but we have to convert our
# list data elements into a string before we can append the information
recipients = string.join(mailList)
mMsg = 'These people were sent e-mails'
#mMsg += contentObject.absolute_url() +
mMsg += recipients
mailhost.send(mMsg, '[EMAIL PROTECTED]', '[EMAIL PROTECTED]',
'Lizard Leaves Announcement email confirmation')
F U cn rd dis U mst uz Linux.
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -