[Zope-CMF] Puzzling script problem with CMF/Plone

Braun Brelin bbrelin@yahoo.com
Wed, 18 Sep 2002 09:48:20 -0700 (PDT)


Hello,

I've created the following python script which is
called as a DCWorkflow object.  

The problem is that the script works fine
when I test it in the Zope admin mode.  However, when
I actually run the script as a user on the plone site,
I get a "Can't find  mailhost object" error. If I
remove the try/except, I get "list index out of range"


Obviously the context.superValues() method isn't
giving 
me back anything, but why does it work under the
Zope Administrator and not when logged in as a user? 
Is there some sort of permission I need to set?  I've
made sure the the Mail Host object does exist under
the portal.   I've also granted permissions  

What I'd really like is to find documentation to help
me debug this problem.  Can someone tell me how to
dump the values of context.superValues()?   

Thanks, 

Braun Brelin


(Ignore the whitespace issue.  It's a mailer problem,
rather than the way the script really looks) 
-------------------------------------------------------
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