[Zope-CMF] Puzzling script problem with CMF/Plone
alan runyan
alan runyan" <runyaga@runyaga.com
Wed, 18 Sep 2002 23:40:15 -0500
#hmmm how about simply
mailhost = context.MailHost
#or
mailhost = getattr(context, 'MailHost', None)
addrs = []
if mailhost not None:
for member in context.portalmembership.listMembers():
if 'Member' in member.getRoles():
addrs.append( member.email )
# or use the power of list incomprehension!
addrs = [member.email for member in context.portal_membership.listMembers()
if 'Member' in member.getRoles() ]
cheers,
~runyaga
> members = context.portal_membership.listMembers()
>
> try:
> mailhost=getattr(context,context.superValues
> ('MailHost')[0].id)
> except:
> raise AttributeError,"Can't find a mail host
> object"
>
> addrs = []
> for member in members:
> if 'Member' in member.getRoles():
> email = member.getProperty('email')
> if email:
> addrs.append(email)
>
> #url = getattr(exprNamespace['object'].absolute_url())
> url = 'test url'
> to_list = string.join(addrs, ',')
> mFrom = 'ciaran@localzope'
> mSubj = 'New Content'
>
> mailhost.send(url, to_list, mFrom, mSubj)
> #return to_list
> -------------------------------------------------------
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! News - Today's headlines
> http://news.yahoo.com
>
> _______________________________________________
> Zope-CMF maillist - Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature requests
>