[Zope3-Users] browser:addview help needed
Amos Latteier
amos at latteier.com
Thu Jan 6 17:44:04 EST 2005
Hi,
I'm trying to figure out how to create custom add forms for content
components that aren't schema-based.
I understand how to use the browser:addform and browser:addMenuItem
directives. How do I create add forms and actions for non-schema content?
It appears that I should use the browser:addview directive. I'm having
trouble using this directive. Here's what I'm trying:
<browser:addview
permission="zope.ManageContent"
class=".test.AddView"
name="add test"
title="add test"
menu="add_content"
>
<browser:page
template="add.pt"
name="add_form.html"
/>
<browser:page
attribute="add"
name="add_action.html"
/>
</browser:addview>
My hope is that this will allow me to view the add form (defined in
add.pt) which can then call the "add_action.html" page that is handled
by the add method of AddView class. The add method would then need to
create an instance and add it using its context which should be an
IAdding object.
When I try running Zope 3 head with this configuration I get:
Traceback (most recent call last):
File "z3.py", line 63, in ?
run()
File "z3.py", line 59, in run
main(argv[1:])
File "/usr/local/src/Zope3/src/zope/app/server/main.py", line 53, in main
setup(load_options(args))
File "/usr/local/src/Zope3/src/zope/app/server/main.py", line 100, in
setup
zope.app.appsetup.config(options.site_definition)
File "/usr/local/src/Zope3/src/zope/app/appsetup/appsetup.py", line
68, in config
context = xmlconfig.file(file, execute=execute)
File "/usr/local/src/Zope3/src/zope/configuration/xmlconfig.py", line
456, in file
context.execute_actions()
File "/usr/local/src/Zope3/src/zope/configuration/config.py", line
585, in execute_actions
callable(*args, **kw)
File "/usr/local/src/Zope3/src/zope/app/component/metaconfigure.py",
line 48, in handler
method(*args, **kwargs)
File "/usr/local/src/Zope3/src/zope/component/adapter.py", line 121,
in register
raise TypeError(iface, IInterface)
zope.configuration.config.ConfigurationExecutionError:
exceptions.TypeError: (u'addsighting', <InterfaceClass
zope.interface.interfaces.IInterface>)
in:
File "/usr/local/src/Zope3/src/sighting/configure.zcml", line 61.0-79.0
<browser:addview
permission="zope.ManageContent"
class=".test.AddView"
name="add test"
title="add test"
menu="add_content"
>
<browser:page
template="add.pt"
name="add_sighting_form.html"
/>
<browser:page
attribute="add"
name="add_sighting_action.html"
/>
</browser:addview>
Does anyone have any suggestions or any examples of correct use of
browser:addview?
Thanks!
-Amos
More information about the Zope3-users
mailing list