[Zope3-Users] Configuration Problems?

Tim Cook timothywayne.cook at gmail.com
Sun Aug 3 18:51:35 EDT 2008


Marius,
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:

    archetypeId=Object(
        schema=IArchetypeId,
        title=_(u"Archetype Id"),
        description=_(u"Multi-axial identifier of this archetype."),
        required=True,

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
__repr__.

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__')
    fields=['adlVersion']

    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?

    invariants=Set(
        title=_(u"Invariants"),
        description=_(u"FOPL invariant statements"),
        required=False,
        value_type=Object(schema=IAssertion),
    )


Thanks,
Tim




-- 
Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook 
Skype ID == timothy.cook 
**************************************************************
*You may get my Public GPG key from  popular keyservers or   *
*from this link http://timothywayne.cook.googlepages.com/home*
**************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20080803/0fe83961/attachment.bin


More information about the Zope3-users mailing list