Submitted by : 127.0.0.1 at: 2005-03-02T09:49:35+00:00 (12 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

Impossible to create a wiki page into plone : the error is NoneType object has no attribute keys

Workaround: add "or {}" to the end of line 61 in Outline.py, or upgrade to the latest from CodeRepos.


comments:

if anyone else gets this, please note here --simon, Wed, 02 Mar 2005 12:34:11 -0800 reply
Name: #1062 Creation of wiki page impossible into Plone => #1062 "no attribute keys" error when creating a page Severity: critical => serious

Trying to add Wiki (with default pages) --SmileyChris?, Thu, 03 Mar 2005 13:50:42 -0800 reply
I can verify this error too. ZWiki 0.39, Win32, vanilla Zope 2.7.4

Ditto, in Zopes 2.7.x -- Thu, 03 Mar 2005 14:17:53 -0800 reply
I just ran into this last night, with Zope 2.7.4 on Linux. Tried previous Zopes, same problem. This is corrected by the fix above, adding : "or {}" to Outline.py at the end of line 61. Recent Zopes give the full error message as follows:

    Traceback (innermost last):
    * Module ZPublisher.Publish, line 175, in publish_module_standard
    * Module ZPublisher.Publish, line 132, in publish
    * Module Zope.App.startup, line 204, in zpublisher_exception_hook
    * Module ZPublisher.Publish, line 101, in publish
    * Module ZPublisher.mapply, line 88, in mapply
    * Module ZPublisher.Publish, line 39, in call_object
    * Module Products.ZWiki.ZWikiWeb, line 43, in manage_addZWikiWeb
    * Module Products.ZWiki.ZWikiWeb, line 111, in addZWikiWebFromFs
    * Module Products.ZWiki.ZWikiWeb, line 173, in _addZWikiPage
    * Module OFS.ObjectManager, line 276, in _setObject
    * Module Products.ZWiki, line 142, in manage_afterAdd
    * Module Products.ZWiki.OutlineSupport, line 312, in wikiOutline
    * Module Products.ZWiki.OutlineSupport, line 235, in updateWikiOutline
    * Module Products.ZWiki.Outline, line 83, in update
    * Module Products.ZWiki.Outline, line 63, in updateChildmap
    AttributeError: 'NoneType' object has no attribute 'keys'

Ditto, in Zopes 2.7.x --Simon Michael, Thu, 03 Mar 2005 15:05:11 -0800 reply
Darn, thanks.

A better fix may be... -- Fri, 04 Mar 2005 13:01:59 -0800 reply
The Outline class already has proper initialization of the childmap. Instead you may want to fix the code that is circumventing that.

Add "if oldchildmap is not None:" before line 227 of OutlineSupport?.py.

--- OutlineSupport.py~  2005-03-02 01:29:18.000000000 -0500
+++ OutlineSupport.py   2005-03-04 15:52:57.521762592 -0500
@@ -224,7 +224,8 @@
         # if there's no outline object, make one
         if not hasattr(self.folder().aq_base,outline):
             self.folder()._setObject(outline, PersistentOutline())
-            self.folder().outline.setChildmap(oldchildmap)
+            if oldchildmap is not None:
+                self.folder().outline.setChildmap(oldchildmap)
         # regenerate the parentmap
         parentmap = {}
         for p in self.pageObjects():

I am able to work with exist data.fs -- Mon, 07 Mar 2005 16:53:07 -0800 reply
If I work within a ZWiki folder obtained by using a data.fs file from a backup, I'm able to create ZWiki pages; but I am not able to create ZWiki pages in a new folder.

Fix works for me -- Wed, 09 Mar 2005 20:45:05 -0800 reply
Thanks. "or {}" worked. That was hair raising while it lasted. My platform:

Zope Version (Zope 2.7.4-0, python 2.3.3, linux2) Python Version 2.3.3 (#1, Apr 14 2004, 12:23:23) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-24)]? System Platform linux2 CMFCore (Installed product CMFCore (CMF-1.4.7)) Archetypes (Installed product Archetypes (1.3.2-final)) CMFPlone? (Installed product CMFPlone? (2.0.5))

fix checked into darcs --simon, Fri, 11 Mar 2005 19:54:09 -0800 reply
Status: open => closed

property change --simon, Fri, 18 Mar 2005 10:13:02 -0800 reply
Name: #1062 "no attribute keys" error when creating a page => #1062 "no attribute keys" error when creating a page with 0.39