[z3-five] AddMenuItem in five

Maciej Wisniowski maciej.wisniowski at coig.katowice.pl
Mon Sep 11 12:12:18 CEST 2006


> How can add my product to my list of available objects and make and 
> instance of it? Is there any way to do that using Five or I have to do 
> it at Zope 2 manner?

You may use addform directive like:

  <browser:addform
     schema=".interfaces.IMainModule"
     content_factory=".main_module.MainModuleFactory"
     name="main_module_addform"
     arguments="default_conn_id"
     permission="zope2.ViewManagementScreens"
     label="Add MainModule"
     >
  </browser:addform>

and in registerClass:

<five:registerClass
        class=".main_module.MainModule"
        meta_type="MainModule"
        permission="zope2.ViewManagementScreens"
        icon="page_code_icon.png"
        addview="main_module_addform"
  />

declare 'addview' to be same as 'name' defined
with addform.

Your MainModuleFactory may be:

def MainModuleFactory(view, id, title, default_conn_id):
    cf = MainModule(id, title, default_conn_id)
    return cf.__of__(view.context)

-- 
Maciej Wisniowski


More information about the z3-five mailing list