[Zope3-Users] Trying to use browser:form -> 404

Florian Lindner mailinglists at xgm.de
Fri Feb 10 16:18:45 EST 2006


Am Freitag, 10. Februar 2006 20:10 schrieb Garanin Michael:
> > I've played with zope.formlib before that. I didn't manage to generate a
> > entire form, just the <input ...> statemenets were generated, without any
> > <html> headers or anything like that. So I need to add them manually with
> > python code or a template. Can you tell me how I can generate a form.
> > Basically the same like the form directive we're talking about all the
> > time.
> >
> >
> > Thanks,
> >
> > Florian
>
> It's easy. Example:
>
> 1) class IMyForm(Interface):
>         title = TextLine(...)
>
> 2) class MyAddForm(zope.formlib.AddForm):
> 	form_fields = IMyForm
>
> 	def create(self, data):
> 	   # create you object from data-dictionary
>
>
>    class MyEditForm(zope.formlib.EditForm):
> 	form_fields = IMyForm
>         # yes it's all ! ;-)
>
> 3) in browser.zcml
>
>   <page
>       name="AddMyObject.html"
>       for="zope.app.container.interfaces.IAdding"
>       class=".MyAddForm"
>       permission="zope.ManageContent"
>       />
>   <page
>       name="edit.html"
>       for=".IMyObjectInterface"
>       class=".MyEditForm"
>       permission="zope.ManageContent"
>       />
>
> P.S. you can see usage zope.formlib in 'zsqlmap' (my product, see
> zope.org ;-)

Thanks for your example. But I've the same error, a 404.

in views.py:

from zope.formlib.form import EditForm
from interfaces import IRegistrationForm

class registrationForm(EditForm):
    form_fields = IRegistrationForm


in configure.zcml:

    <page
        name="registrationForm.html"
        class=".views.registrationForm"
        permission="zope.Public"
        layer="centershock"
        for="CS.centershock.interfaces.ICentershock" />


And I try to call it with:

/++skin++centershock/cs/registerForm.html whereas cs is a ICentershock object.

It still gives a 404.

Any guess what's wrong?

Thanks,

Florian


More information about the Zope3-users mailing list