[Zope] Passing Parameters to External Methods

J Cameron Cooper zope-l at jcameroncooper.com
Wed Nov 16 12:12:30 EST 2005


Asad Habib wrote:
> Hello. I am trying to use the Python version of the PHP script written 
> by Jason Rust called 'HTML_ToPDF.php'. I have represented this script 
> using an External Method since it uses functions, such as open, which 
> cannot be used in Zope Python scripts for security reasons. The python 
> code for the script consists of a class definition and so I have had to 
> create a python function which instantiates an object of this class. 
> However, I am having toruble passing parameters to this function which 
> are needed by the class constructor to instantiate an object of this 
> class. Can parameters be passed to external methods? Whenever I try to 
> pass parameters to function 'createHtmlToPdf', Zope returns an error 
> stating that no such function exists. Other on the hand, if I pass no 
> parameters this call is successful but the init function fails 
> complaining that three parameters are expected. I have provided a 
> snippet of my code below. Any help would be greatly appreciated. Thanks.

 > def createHtmlToPdf(in_htmlFile, in_domain, in_pdfFile):
 >    return html2pdf(in_htmlFile, in_domain, in_pdfFile)

Functions in external methods generally start with the 'self' parameter. 
Your description of the error messages doesn't entirely support my 
supposition, but you could try it.

		--jcc
-- 
"Building Websites with Plone"
http://plonebook.packtpub.com/

Enfold Systems, LLC
http://www.enfoldsystems.com


More information about the Zope mailing list