[Zope] - Database difficulty

A.M. Kuchling akuchlin@cnri.reston.va.us
Mon, 7 Dec 1998 20:35:31 -0500


So far Principia products have only been written by experienced
developers, but with random bozos messing around with buggy
partially-implemented Products, the management code is going to have
to be made more resilient against bad objects.  Here's an example
traceback I got:

Sorry, an error occurred.

Traceback (innermost last):
  File /home/opt/zope/lib/python/ZPublisher/Publish.py, line 861, in publish_module
  File /home/opt/zope/lib/python/ZPublisher/Publish.py, line 583, in publish
    (Info: /manage_main)
  File /home/opt/zope/lib/python/Globals.py, line 222, in __call__
    (Object: manage_main)
  File /home/opt/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__
    (Object: manage_main)
  File /home/opt/zope/lib/python/DocumentTemplate/DT_In.py, line 675, in renderwob
    (Object: objectItems)
  File /home/opt/zope/lib/python/OFS/SimpleItem.py, line 144, in title_and_id
    (Object: Item)
AttributeError: id

	The problem in this case arose from a syntax error in the
code for the product, which made the module import fail.  When I
changed title_and_id(self) to:
        t=self.title
        try:
            i=self.id
        except AttributeError:
            i="No ID!" + repr(self)
        return t and ("%s (%s)" % (t,i)) or i

Zope correctly displayed that this object was broken.  I'm not sure if
this suggested change is the right one, but it worked for me...

-- 
A.M. Kuchling			http://starship.skyport.net/crew/amk/
You have called me here, Haroun. It is unwise to summon what you cannot
dismiss.
    -- Dream, in SANDMAN #50: "Ramadan"