----- Original Message ----- From: "David Bear" <[EMAIL PROTECTED]>
To: "zope" <Zope@zope.org>
Sent: Friday, July 06, 2007 5:55 PM
Subject: [Zope] handling exceptions for external methods

I've begun using external methods and am trying to better understand the
context they run and and how to handle exceptions. I have concluded
the following (and I don't recall reading some of these in any documentation)
(please correct me if I'm wrong)

3 external methods inherit the same namespace available to scripts
running inside zope

when you define your external method routine:   def xxx(self, ....)
you gain access to zope namespace via self  (eg. self.REQUEST)

6 external methods must return only strings, but they may be unicode
string as long as they are valid xml string data

No. External methods can return any python type you like (lists, tuples, dictionaries, etc).

Something that I don't understand is how to handle an exception. For
example, if I have an external method that appends data to the end of
a file, if there is an IOException how to I capture it and send a
message back to zope with something informative?

Look up  try/except in a python lib doc.


Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to