Hi all,

At work, I am testing our software that sends a postback via http to a test
server on a periodic basis.

I wrote the test server on our plone system.  I have a page template that calls
a python script.  The python script gets all of the parameters and writes out
their value to printed and then mails it off to a list of email addresses. 
Pretty simple system.

When I the software I am testing calls this page (via an http post) I get the
email message, but none of the parameters or their values are included in the
email.  I have another test server, this time written as a servlet running on
Tomcat, that successfully logs the parameters and their values when called by
the software.

Now you might think that the problem is with the Zope based server, but I am
able to successfully call the page via:

o   a form I setup in the same directory as the page template;
o   the above form on a different computer;
o   the unix wget utility on the server making the http post.

Prior to this, I noticed that the message never got sent unless I was logged in
and using the form on the test server.  I fixed this by changing the MailHost's
security parameter to enable "Use mailhost services" for all users.  I looked
over the other possible security permissions, but none jumped out at me that
they might be a problem.

Any suggestions would be most helpful.  



Here are the relevant ZPTs/scripts:

notify ZPT

<h1 tal:replace="structure here/standard_html_header">Header</h1>
<p tal:replace="structure python:here.notify_py()" />

<h1 tal:replace="structure here/standard_html_footer">Footer</h1>

notify_py Python Script

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST

d = request.form.items()

# Return a string identifying this script.
print "<p>This is the", script.meta_type, '"%s"' % script.getId(),
if script.title:
    print "(%s)" % html_quote(script.title),
print "in", container.absolute_url()
print "</p>"

# Log what we received
print "<p>"
for arg in d:
  key = arg[0]
  value = arg[1]
  print key, ": ", value, "<br />"
print "</p>"

#  send email
#    if that fails, then tell user to email us that they got an error

  mfrom = "[EMAIL PROTECTED]"
  subject = "notification message"
  body = printed
  context.MailHost.simple_send(mto, mfrom, subject, body)
  return printed
except Exception:
  errorText = '<h1>Ooooppps!</h1><p>There was an error submitting your
information to our database and our backup logging method.  Please email the <a
href="mailto:[EMAIL PROTECTED]">QA Dude</a> that you got an error so that we
can track it down and fix it.</p><p>Thanks!</p>'
  print errorText
  return printed
Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to