[Zope3-Users] z3c.form and subforms in an AddForm?

Matt Bowen mrbowen at gmail.com
Tue Jul 3 08:57:28 EDT 2007


Hi Stephen

I'm in the same place as Hermann -- I've followed formdemo's message package
as closely as I can and made an object in debug mode, but when I try to view
or edit it, zope says it can't find index.html or edit.html. At some point I
realized that I was retyping code I had previously deleted and was thus
going in circles, so any help would be deeply appreciated. I'll admit now
that I'm pretty new to zope 3 and am trying to work both from your examples
and doctests and Philipp's book, so I may be muddled in more than one place.

On 6/19/07, Stephan Richter <srichter at cosmos.phy.tufts.edu> wrote:
>
>
> Are you sure your skin has the correct layer in it? Have you looked at the
> Hello World example in z3c.formdemo?
>
>
Could you explain this a little more? I have declared a layer as follows:

from z3c.form.interfaces import IFormLayer
from z3c.layer.pagelet import IPageletBrowserLayer

class IMovingTargetBrowserLayer(IFormLayer, IPageletBrowserLayer):
    """The moving target browser skin layer"""

and registered it:
    <!-- Moving Target Skin Layer -->
  <interface
      interface="movingtarget.layer.IMovingTargetBrowserLayer"
      type="zope.publisher.interfaces.browser.IBrowserSkinType"
      name="MovingTargetLayer"
    />

Then I have a browser skin:

from z3c.formui import interfaces
from movingtarget.layer import IMovingTargetBrowserLayer

class IMovingTargetBrowserSkin(interfaces.IDivFormLayer,
IMovingTargetBrowserLayer):
    """The Moving Target Browser skin"""

which I register:

  <zope:interface
      interface="movingtarget.skin.browserskin.IMovingTargetBrowserSkin"
      type="zope.publisher.interfaces.browser.IBrowserSkinType"
      name="MovingTargetBrowser"
      />

  <!-- layout template -->
  <z3c:layout
      for="*"
      layer="movingtarget.layer.IMovingTargetBrowserLayer"
      template="template.pt"
      />

I have very simple edit and display classes:

class NextActionEditForm(form.EditForm, layout.FormLayoutSupport):
    """A simple edit form for Next Actions"""
    label = u"Next Action Edit Form"
    fields = field.Fields(INextAction)

class NextActionDisplayForm(form.DisplayForm, layout.FormLayoutSupport):
    """The display form for NextActions"""
    fields = field.Fields(INextAction)

which I *think* I've registered edit and displays view with the following:

  <!-- Edit Form -->
  <z3c:pagelet
      name="edit.html"
      for="movingtarget.interfaces.INextAction"
      class=".nextaction.NextActionEditForm"
      layer="movingtarget.skin.browserskin.IMovingTargetBrowserSkin"
      permission="zope.ManageContent"
      />

  <!-- Display Form -->
  <z3c:pagelet
      name="index.html"
      for="movingtarget.interfaces.INextAction"
      class=".nextaction.NextActionDisplayForm"
      layer="movingtarget.skin.browserskin.IMovingTargetBrowserSkin"
      permission="zope.Public"
      />

  <z3c:template
      template="nextactionview.pt"
      for=".nextaction.NextActionDisplayForm"
      layer="movingtarget.skin.browserskin.IMovingTargetBrowserSkin"
      />

But when I click on the name of my interpreter-made object, I get a 404.
Anything obvious I'm missing?

Thank you,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20070703/0a077fbc/attachment-0001.htm


More information about the Zope3-users mailing list