[Zope3-dev] Accessing object data when using Schemas?

Steve Alexander steve@cat-box.net
Thu, 24 Apr 2003 17:14:12 +0200


> Is it possible to access first and last using something like
> http://host:8080/sampleContact/first?

No. Unless you make it so.


> I know this doesn't work, but is
> there some way? Jim's tutorial says Iwidget - but I can't follow how to
> use it.

No.

You have to provide a "publication traversal" component for IContact 
that publishes the methods or attributes of the object. This is similar 
to what happens in Zope 2.

However, this is not such a good idea in general, because you'd be 
publishing your content object directly to the web, rather than using a 
separate "presentation component" to do that work.

A better thing to do is to provide a browser:page for your content 
object called 'first' that looks like this:

class PageThatPresentsFirst:

     def __call__(self):
         return self.context.first

--
Steve Alexander