[Zope-CMF] Trouble using workflow script to send email.

Nava, Christopher L. Contractor navachrl at JICPAC.PACOM.MIL
Tue Feb 10 20:13:20 EST 2004


Got it working...
Just had to adjust the permissions of the MailHost to allow "Use mailhost services"
--Chris

-----Original Message-----
From: Nava, Christopher L. Contractor 
Sent: Tuesday, February 10, 2004 12:59 PM
To: 'zope-cmf at zope.org'
Subject: RE: [Zope-CMF] Trouble using workflow script to send email.


Ignore my last...

raise (failures) results in:
	Error Type: ['editor', 'fdo']		# Editor and fdo are the users with review roles!
	Error Value: None

Looks like the MailHost is not working cdorrectly.

Any help here?

-----Original Message-----
From: Nava, Christopher L. Contractor 
Sent: Tuesday, February 10, 2004 12:50 PM
To: 'Lennart Regebro'; zope-cmf at zope.org
Subject: RE: [Zope-CMF] Trouble using workflow script to send email.


Using the raise method it looks like maybe state_change is not being set.

raise str(context.getReviewersFor(object)
Results in:
	Error Type: [, ]
	Error Value: None

raise str(object) OR raise str(state_change)
Results in:
	Error Type:
	Error Value: None

FYI: zLOG worked in the Extension script (getReviewersFor()) portion of the recipe but not the workflow script.

--Chris

--- SCRIPT SHOWN BELOW ---
#parameters = state_change
mailhost = context.MailHost
object = state_change['object']
msg = object.absolute_url() + ' is pending review.  please help it.' m_to = 'runyaga at acme.com' m_from = 'runyaga at acme.com' m_subj = 'review pending'

#raise goes here...

failures = []
for reviewer in context.getReviewersFor(object):
    try:
        mailhost.send(msg, reviewer.email, m_from, m_subj)
    except Exception,e:
        failures.append(reviewer.getUserName())

return failures

-----Original Message-----
From: Lennart Regebro [mailto:regebro at nuxeo.com] 
Sent: Tuesday, February 10, 2004 12:18 AM
To: Nava, Christopher L. Contractor; zope-cmf at zope.org
Subject: Re: [Zope-CMF] Trouble using workflow script to send email.


From: "Nava, Christopher L. Contractor" <navachrl at JICPAC.PACOM.MIL>
> Also, Anyone have some debugging tips for a newbie python programmer?

Scripts are a bit of a pain to debug.

Two ways:

from zLOG import LOG
LOG('blablabla', 200, 'more text you want printed', 'even more text yu want
printed')
This will print out a log. You may have to change the rights to what can be imported first, I think you aren't aloowed to import things from zLOG by default.

Second trick is to do a raise str(whatever) in the middle of a script to check the variables.

In this case, a raise str(msg) to check what the message is, or a raise
str(context.getReviewersFor(object)) to make sure you really HAVE a list, are good things to start with.





**********************************************************************
This email and any files transmitted with it are intended solely
for the use of the individual or entity to whom they are 
addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

**********************************************************************




More information about the Zope-CMF mailing list