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

Florian Lindner mailinglists at xgm.de
Sat Feb 11 11:24:50 EST 2006


Am Samstag, 11. Februar 2006 16:51 schrieb Helmut Merz:
> Am Samstag, 11. Februar 2006 14:11 schrieb Florian Lindner:
> > > > blablubb is a field of my interface.
> > >
> > > Of which interface? IRegistrationForm only or also
> > > ICentershock? (and no typos? ;-))
> >
> > of IRegistrationForm and not of ICentershock
>
> I see...   Seems to be OK for what you're wanting to do.
>
> > Note that I don't want to edit an ICentershock object, I don't
> > want to edit any kind of object. I just want to create a form
> > based on a schema. The schema has no use but to provide the
> > fields information for the form. The processing of the data
> > entered is done manually in python code.
> >
> > registrationForm.html is not a view on a Centershock object.
> > It should be a form in which the user can enter data that is
> > being processed by the view class and ultimately create an
> > user in a PAU utility. The ICentershock objects should server
> > as a kind of root object of my application, the object that
> > provided all the pages that can't be assigned to an instance
> > of an object (like contact information or the powered by Zope
> > page).
>
> OK, but for EditForm you need an object the fields of the form
> can be bound to. If that's not a content object it could just be
> an adapter.
>
> Another and probably better way in this case would be not to
> derive from EditForm but from Form.
>
> I just have to solve a similar problem and got it working the
> following way (IPersonRegistration is the schema for the form,
> INode is the interface of something like your Centershock
> object):
>
> browser/configure.zcml:
>
>   <browser:page
>       name="registration.html"
>       for="..interfaces.INode"
>       class=".registration.PersonRegistrationView"
>       permission="zope.Public" />
>
>
> browser/registration.py:
>
> from zope.formlib.form import Form, FormFields, action
> from zope.formlib.i18n import _
>
> class PersonRegistrationView(EditForm):
>
>     form_fields = FormFields(IPersonRegistration)
>
>     @action(_("Apply"))
>     def handle_edit_action(self, action, data):
>         print data # here we'll do the real stuff...
>
>
> As often with Zope 3: simple but not easy (to find out) ;-)

I couldn't express it better...

Thanks a lot, it works now!

Florian


More information about the Zope3-users mailing list