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


[Zope3-Users] Configuration Problems?

2008-08-01 Thread Tim Cook
Hi All,

I've read all the books and readme's as well as most of the source. I
also went through as many tutorials as I could find.  I just can't seem
to 'get' the configuration process for the ZCA.

I used Paul Carduner's ZContact tutorial.  I had no problem with it.  

I have a rather large healthcare project based on a robust set of
specifications.  Most of the implementation for the specifications are
complete.  We are just finishing a 10 day workshop on implementing these
specs. using the ZCA as the application server.  We made some great
improvements in the code. But ..

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.

If you have ZCA skills and are interested in getting into a field
developing interoperable healthcare applications for NGOs and
governments worldwide then we can offer to teach you the intricacies of
these specs in exchange for your help.  We NEED you!

Running paster serve debug.ini:
The exact issue at this point is that we built a skin and layer as well
as a display form using the zc3.* eggs modeled after the ZContact
example. Using the introspector from the ZMI shows the contents of the
object and all looks okay.  But if we try to use the skin and form
(named index.html) using a URL like this:
http://127.0.0.1:8080/++skin
++DemoAT/AR/openEHR-EHR-EVALUATION.goal.v1/@@index.html 

we get a ComponentLookupError (traceback below).  I just can't seem to
figure out WHERE the look up error is coming from.  

I do see that if adapter is None:'  raises the error and my  guess is
that there isn't one registered for Archetype objects (these are not
Plone Archetypes).  So, where to look?

The source is available at:
http://www.openehr.org/svn/ref_impl_python/TRUNK/oship 

Since this is based on zopeproject the configure files and browser
subdirectory are at:
http://www.openehr.org/svn/ref_impl_python/TRUNK/oship/src/oship/ 

Thanks for taking a look and I hope I can encourage some (one at least)
of you to spend some time with us on this rapidly growing project.

Cheers,
Tim

=
URL: http://127.0.0.1:8080/%2B%2Bskin%2B%
2BDemoAT/AR/openEHR-EHR-EVALUATION.goal.v1/%40%40index.html
Module paste.evalexception.middleware:306 in respond 
Module zope.app.wsgi:54 in __call__ 
  handle_errors = environ.get('wsgi.handleErrors', True)

request = publish(request, handle_errors=handle_errors)
response = request.response  request = publish(request,
handle_errors=handle_errors)
Module zope.publisher.publish:133 in publish 
Module zope.app.publication.zopepublication:167 in callObject 
security proxied zope.app.publisher.browser.viewmeta.ArchetypeDisplayForm 
instance at 0x217ebd0

Module zope.publisher.publish:108 in mapply 
Module zope.publisher.publish:114 in debug_call 
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'')
=  



-- 
**
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