[Zope-dev] manage_options in 2.3

Andy McKay andym@ActiveState.com
Wed, 7 Feb 2001 10:10:03 -0800


Thanks for the new management interface guys I happily wrote a product last
night and did a quick interface using the standard Folder interface and
fiddled with filtered_meta_types list and dontAllowCutandPaste and so on. A
quick How-To will be on its way. I got a wierd error trying to fiddle with
manage_options though, in the olden days something like this worked:

    manage_options = (
        ( Folder.manage_options[0], ) +
        ( {'label':'View', 'action':'my_index_html', ) +
        ( Folder.manage_options[2:], )
        )

But I kept getting this error in 2.3:

    (Object: manage_tabs)
  File E:\Zope23\lib\python\App\special_dtml.py, line 236, in _exec
    (Object: manage_tabs)
  File E:\Zope23\lib\python\DocumentTemplate\DT_With.py, line 133, in render
    (Object: _(manage_options=filtered_manage_options()))
  File E:\Zope23\lib\python\DocumentTemplate\DT_Util.py, line 334, in eval
    (Object: _(manage_options=filtered_manage_options()))
    (Info: filtered_manage_options)
  File <string>, line 0, in ?
  File E:\Zope23\lib\python\App\Management.py, line 119, in
filtered_manage_options
    (Object: Traversable)
AttributeError: (see above)

Error Type: AttributeError
Error Value: 'tuple' object has no attribute 'get'

It seems its looking for a tuple of dicts? But looking at Folder on other
classes their manage_options hasn't changed. I then found this hack worked
(looking at this morning it could be improved):

    _m = list(Folder.manage_options)
    _m[1] = {'label':'View','action':'my_index_html'}
    manage_options = (_m)

Whats going on?

--
  Andy McKay.