How do I find out which context I'm passing?

Braun Brelin bbrelin at
Wed Sep 18 15:07:45 EDT 2002

I'm running into a strange problem.  I've written a small e-mail
sender python
script for Zope/CMF/Plone.  It gets activated from DCWorkflow.  

The script works fine when I test it from the "manage" interface, i.e.
I save
the script and then push the "test" button.  

When I try and run it from my portal, however, the script fails. 

The script looks like this:

members = context.portal_membership.listMembers()

   mailhost = getattr(context,context.superValues('Mail Host')[0].id)
   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:

#url = getattr(exprNamespace['object'].absolute_url())
url = 'test url'
to_list = string.join(addrs, ',')
mFrom = 'ciaran at localzope'
mSubj = 'New Content'

mailhost.send(url, to_list, mFrom, mSubj)
#return to_list


The script constantly gets a "No mailhost found" error.  Which means,
I presume,
that the getattr(context, context.superValues()) function call fails. 

The only reason that I can think of for this happening is that the
context that's passed when I test it via the manage window is a
different context
than that which gets passed within the users portal window.  

There is definitely a MailHost object defined within the portal

Anybody have any thoughts on how to debug this?


Braun Brelin

More information about the Python-list mailing list