Submitted by : koegler at: 2006-06-30T06:27:10+00:00 (11 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

(Zope 2.7.4-0, python 2.3.5, openbsd3), CMF 1.5.5

when giving SomePage?.metadataFor(AnotherPage?) wrongly not a page, but e.g. a string with a page name, Zope restarts sliently. I don't know whether the patch below is a proper fix, because I don't know if is's supposed to work with something different than 'Zwiki Pages'. Also I don't know if Zope just should die silently, but thats another story and Zope 2.7 is not the freshest. Anyways, this keeps me from shooting myself into my foot too much:

# diff -u Utils.py.dist Utils.py
--- Utils.py.dist       Fri Jun 30 15:08:32 2006
+++ Utils.py    Fri Jun 30 15:13:58 2006
@@ -25,7 +25,8 @@
     ZOPEVERSION = (9,9,9) # (cvs)

 from Products.ZWiki import __version__
-from Defaults import PREFER_USERNAME_COOKIE, PAGE_METADATA, BORING_PAGES
+from Defaults import PREFER_USERNAME_COOKIE, PAGE_METADATA, BORING_PAGES,\
+        PAGE_METATYPE
 import Permissions
 from I18n import _

@@ -203,6 +204,8 @@
         class PageBrain(SimpleItem): # XXX why a SimpleItem ?
             def __init__(self,obj): self._obj = obj
             def getObject(self): return self._obj
+       if getattr(page, 'meta_type', None)!=PAGE_METATYPE:
+           raise TypeError(str(page)+' is not a '+PAGE_METATYPE)
         brain = PageBrain(page)
         for attr in PAGE_METADATA+['page_url','title_or_id']:
             # protect against import or attr errors when a page type has

investigate --betabug, Mon, 17 Sep 2007 12:02:04 -0700 reply

put On Betabug's List

confirmed, patch applied + sent to darcs --betabug, Mon, 17 Sep 2007 12:47:58 -0700 reply

Status: open => closed

The patch is in darcs now. Thanks koegler for the report and the patch!