Thanks for the feedback.

On Fri, 2008-08-01 at 21:13 +0300, Marius Gedminas wrote:
> The traceback shows you the WHERE, but that's not interesting.  The WHY
> is interesting, 

Very true.

> and I could make a guess.

> Your form schema contains a plain Field() field.  Zope has no widgets
> for this.
> Usually this happens when you define a content object's interface
> inheriting from IContained or ILocation.  The fix is to omit __name__
> and __parent__ from the interface.

> and I'd change it to
>     class ATDemoDisplayForm(form.Form):
>         """A simple display form Archetypes."""
>         fields = field.Fields(IArchetype).omit('__name__', '__parent__')
>         mode = DISPLAY_MODE

Okay.  This wasn't 'the solution'  but it did give me a hint as to the
cause of the problem.  

In the project we have many complex classes where attributes are of
another type within the project and not one of the basic zope.schema
types.  Their interface looks like this:

        title=_(u"Archetype Id"),
        description=_(u"Multi-axial identifier of this archetype."),

So, since there are no widgets for these types of fields I assume then
they will cause the same error?  I had hoped that it would just return a

So just to show something in the browser to be sure I have the wiring
correct I tried to figure out how to only display one attribute that
does have a widget:

    adlVersion = TextLine(
        title = _(u"adlVersion"),
        description = _(u"""ADL version if archteype was read in from an
ADL sharable archetype."""),
        required = False,
        default = None

I tried changing the display form to:
class ArchetypeDisplayForm(form.Form):
    """A simple display form for archetypes."""

    #fields = field.Fields(IArchetype).omit('__name__', '__parent__')

    mode = DISPLAY_MODE

But this returns:
AttributeError: 'list' object has no attribute 'values'

in the browser (running paster serve debug.ini).

So I assume fields should be a mapping but looking through the text
files in z3c.form I can't determine the expected contents.  

In fact I find this Zope convention of showing examples being created in
the Python interpreter to be very confusing.  I'm sure that if you are
already familiar with the components it can be intuitive.  But for
someone that doesn't know their way around yet (me).  It is difficult to
determine how the code should look in a module when so often certain
things have been imported or created in an earlier example.  

Case in point.  I want to start by just displaying the contents of my
instance that has already been created and stored in the ZODB.  I may
never need an add form, only edit and display forms.     

BTW:  Is this the proper way to say that I want an attribute that is a
Set and the contents must implement IAssertion?

        description=_(u"FOPL invariant statements"),


Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile: 
Skype ID == timothy.cook 
*You may get my Public GPG key from  popular keyservers or   *
*from this link*

Attachment: signature.asc
Description: This is a digitally signed message part

Zope3-users mailing list

Reply via email to