Re: [Zope3-Users] Configuration Problems?

2008-08-03 Thread Tim Cook
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=_(uArchetype Id),
description=_(uMulti-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 = _(uadlVersion),
description = _(uADL 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=_(uInvariants),
description=_(uFOPL 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*
**


signature.asc
Description: This is a digitally signed message part
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Configuration Problems?

2008-08-03 Thread Tim Cook

On Sun, 2008-08-03 at 19:52 -0300, Tim Cook wrote:

  
 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']

I've been staring at this too long I guess.  :-)

Of course:
fields=field.Fields(IArchetype['adlVersion'])
works fine.  So now I have something in my browser.  

The question about all those potential custom widgets still exists
though.Is there a 'magic' Object widget that will walk the tree all
the way to the leaf of each object and use the z3c widget???  Probably
not but I am hoping.

Cheers,
Tim





-- 
**
Join the OSHIP project.  It is the standards based, open source
healthcare application platform in Python.
Home page: https://launchpad.net/oship/ 
Wiki: http://www.openehr.org/wiki/display/dev/Python+developer%27s+page 
**


signature.asc
Description: This is a digitally signed message part
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Configuration Problems?

2008-08-01 Thread Marius Gedminas
On Fri, Aug 01, 2008 at 12:29:28PM -0300, Tim Cook wrote:
 When it comes to actually viewing our content with a browser we fail.  I
 thought that certainly a workshop full of bright people working all day
 on this problem would be able to discover what is missing; nope.
...
 we get a ComponentLookupError (traceback below).  I just can't seem to
 figure out WHERE the look up error is coming from.  

The traceback shows you the WHERE, but that's not interesting.  The WHY
is interesting, and I could make a guess.

 The source is available at:
 http://www.openehr.org/svn/ref_impl_python/TRUNK/oship 
...
 =
 URL: http://127.0.0.1:8080/%2B%2Bskin%2B%
 2BDemoAT/AR/openEHR-EHR-EVALUATION.goal.v1/%40%40index.html
...
 Module z3c.form.form:189 in __call__ 
 Module z3c.form.form:184 in update 
 Module z3c.form.form:134 in update 
 Module z3c.form.form:126 in updateWidgets 
 Module z3c.form.field:241 in update 
 Module zope.component._api:103 in getMultiAdapter 
   adapter = queryMultiAdapter(objects, interface, name,
 context=context)
 if adapter is None:
 raise ComponentLookupError(objects, interface, name)
 return adapter  raise ComponentLookupError(objects, interface,
 name)
 ComponentLookupError: ((zope.schema._bootstrapfields.Field object at
 0x7f9af8717ad0, zope.publisher.browser.BrowserRequest instance
 URL=http://127.0.0.1:8080/++skin
 ++DemoAT/AR/openEHR-EHR-EVALUATION.goal.v1/@@index.html),
 InterfaceClass z3c.form.interfaces.IFieldWidget, u'')
 =  

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.

Without looking very deeply into your project, I suspect
http://www.openehr.org/svn/ref_impl_python/TRUNK/oship/src/oship/browser/atdemo.py

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

Marius Gedminas
-- 
If it wasn't for C, we'd be using BASI, PASAL and OBOL


signature.asc
Description: Digital signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users