Asad Habib wrote:
Hi Cameron. You are right but the self parameter is implicitly passed.
It is implicitly passed, but must be explicitly defined::
def createHtmlToPdf(self, in_htmlFile, in_domain, in_pdfFile):
return html2pdf(in_htmlFile, in_domain, in_pdfFile)
When you say::
context.createHtmlToPdf(in_htmlFile, in_domain, in_pdfFile)
Python ends up calling this method/function something like::
createHtmlToPdf(context, in_htmlFile, in_domain, in_pdfFile)
Your message signature must agree.
--jcc
On Wed, 16 Nov 2005, J Cameron Cooper wrote:
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
_______________________________________________
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
--
"Building Websites with Plone"
http://plonebook.packtpub.com/
Enfold Systems, LLC
http://www.enfoldsystems.com
_______________________________________________
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )