[z3-five] AddMenuItem in five
Daniel de la Cuesta
cues7a at yahoo.es
Tue Sep 12 09:29:19 CEST 2006
Maciej Wisniowski <maciej.wisniowski at coig.katowice.pl> escribió: Again... why you're not sending your messages to the list??!
Sorry,
> What about "name='main_module_addform'" in ZCML?
Directive:
...
name="main_module_addform"
...
says that the view for adding your content will be '@@main_module_addform'.
You may call this 'addMe' or whatever you want but you have to point
to same name with registerClass 'addview' attribute:
(...)
addview="main_module_addform"
/>
or if you changed name in addform it may be:
(...)
addview="addMe"
/>
It is a pair here: addform and registerClass.
> What's main_module_addform is it an html page with a form or a method?
Name of the view.
--
Maciej Wisniowski
Ok, I have followed all the steps, here is a summary:
1.- I want to create a zope product and add it to my drop and down list of available items using "Five".
2.- I have my interfaces.py module and my Main_Module.py files:
class MainModule(Folder):
"""MainModule"""
implements(IMainModule)
isPrincipiaFolderish = 1
def __init__(self, id, title, default_conn_id):
self.id = id
self.title = title
self.default_conn_id = default_conn_id
(...)
def MainModuleFactory(view, id, title, default_conn_id):
cf = MainModule(id, title, default_conn_id)
return cf.__of__(view.context)
3.- In my configure.zcml I have:
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:browser="http://namespaces.zope.org/browser">
<five:implements
class="Products.MyProduct.main_module.MainModule"
interface="Products.MyProduct.main_module.MainModule"
/>
<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"
/>
</configure>
Finally, when I run zope I get the following error in my configure.zcml file:
NameError: name '_' is not defined
---------------------------------
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://codespeak.net/pipermail/z3-five/attachments/20060912/c8b4f4bc/attachment-0001.htm
More information about the z3-five
mailing list