[Zope] Using ZPublisher.Client

Michel Pelletier michel@digicool.com
Mon, 16 Aug 1999 21:59:36 -0400


Tony Lownds wrote:
> 
> [If this is better suited to zope-dev then feel free to reply there and cc
> me]
> 
> Hi,
> 
> I am having some problems with ZPublisher.Client. I am using that module
> to make a bridge between e-mail and Zope (its practically done except for
> these problems and packaging it).
> 
> 1. Problem I have stated in previous posts: I cannot send a list of
> attachments.
> 
> In other words, ZPublisher.Client.call(url, att=[open(file1),
> open(file2)]) will not send the Right Stuff. I guess I would like to hear
> whether this is a bug in DC's opinion (its a pretty obscure situation),
> and if so would it probably be fixed by 2.0.0. Otherwise I will design
> around the problem.
> 
> 2. Sending to Zope 2.0.0b4 server doesn't work at all.
> 
> I can use ZPublisher.Client.call to send data correctly to a
> normal Python CGI script, including files, but when I tried the same to a
> Zope server, the client hangs. Actually the server also crashed one time.
> I am running it through ZServer not Apache. I can upload files
> through the browser just fine. Can anyone else duplicate this problem?
> 
> Help me out, so you can use Zope to handle your e-mail!
> 

This works for me:

A DTML method in the root folder named 'DD' contains:

<!--#var standard_html_header-->

<dtml-in stuff>
  <dtml-var sequence-item>
</dtml-in>

<!--#var standard_html_footer-->

(Note that that you can mix DTML sytax for no good reason).

If I call it like:
>>> Client.call('http://aldous:10080/DD', stuff=['one', 'two'])

It works dandy:

Client.call('http://aldous:10080/DD', stuff=['one', 'two'])
(<mimetools.Message instance at 80d39e0>,
'<HTML><HEAD><TITLE>Zope</TITLE></HEAD><BODY BGCOLOR="#FFFFFF">\012\012 
one\012  two\012\012<p><a href="http://www.zope.org/Credits"><img
src="http://aldous/p_/ZopeButton" width="115" height="50" border="0"
alt="Powered by Zope"></a></p>\012</BODY></HTML>')
>>> 


Note that it iterated over the 'stuff' list and rendered two items,
'one' and 'two'.

Is the thing you're calling expecting 'att' to be a sequence?

-Michel

> -Tony Lownds
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )