As Marco said, use formlib, e. g. like this

    menu="zmi_views" title="Edit a SidPage"

    class="myview.EditView" <--- ***


and in

  from ... import ISidPage
  from zope.formlib import form
  class EditView(form.EditForm):


    # here you can redefine some of the
    # methods/actions/etc. of form.Editform

(personally I prefer <browswer:page> over
<browser:editform>) and I am redefining
e. g.

   template = namedtemplate.NamedTemplate('...')

   def setUpWidgets(self, ...)

   @action("...", ...)

Note that there is one action already defined in EditForm
called handle_edit_action. You can reuse this one
(and add some more actions) with

  actions=form.EditForm.actions[:]  (*, see below)

or if you leave out line (*) you effectivly start
with no actions - i. e. you just use your self-defined

Also I found the setup of a template (a ZPT) in EditView
a bit tricky, what works for me is this:


  my_pt = namedtemplate.NamedTemplateImplementation(

as well as (mentioned above already) in myview.EditView:
  template = namedtemplate.NamedTemplate('whatever')  

configuration with

  <adapter factory=".myview.my_pt" name="whatever" />

Have a look at these files:


On Sun, Jul 09, 2006 at 10:05:47AM -0700, Siddhartha Azad wrote:
> Hi,
> I have the following lines in my configure.zcml to add
> a content object "SidPage":
> <browser:editform
>         schema="sidsite.ISidPage.ISidPage"
>       label="Edit"
>       name="edit.html"
>       menu="zmi_views" title="Edit a SidPage"
>       permission="zope.ManageContent"/>
> When I click on an existing "SidPage" on the ZMI, it
> takes me to a form where I have Refresh or Change, and
> since a SidPage is Persistent, it saves the value into
> My question is, what if I wanna do some intermediate
> processing onto the values for ISidPage attribs that
> the user entered into the form, before saving them? Is
> there a way to provide a python class or a ZPT as a
> hook when the actual post on these auto-generated
> forms is done?
> Thanks, Sid.
> _______________________________________________
> Zope3-users mailing list
> !DSPAM:44b1521e64502984811091!
Zope3-users mailing list

Reply via email to