[Zope] Error in treating custom exception

Marco Bizzarri m.bizzarri at icube.it
Tue Jul 19 04:31:00 EDT 2005


Hi all.

It looks like I've hit something which is already known (I've found this 
reference:

http://mail.zope.org/pipermail/zope-collector-monitor/2004-October/004316.html

)

I've a custom standard_error_html page, made with a Zope Page Template. 
I'm trying to provide a custom __str__ for a custom exception. This 
works, most of the time, but in some cases I encounter the following error:

TypeError: unbound method __str__() must be called with InvalidFolderId 
instance as first argument (got nothing instead)

InvalidFolderId is the custom exception, of course.

This is the code of the exception:

class InvalidFolderId(Exception):

     def __init__(self, folder_id):
         self.folder_id = folder_id

     def __str__(self):
         return "folder id %s could not be found in the database" % 
self.folder_id


folder_id is a number. What could be done to avoid this problem?

Thank you in advance for the help.

Regards
Marco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m.bizzarri.vcf
Type: text/x-vcard
Size: 328 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20050719/f40cbdcc/m.bizzarri.vcf


More information about the Zope mailing list