[Zope3-Users] Re: How to make content object return a view?

2006-05-26 Thread Philipp von Weitershausen
David Johnson wrote:
 I have a content object, that I want to return a view.  How is this
 done?

It usually isn't.

 This situation seems to come up frequently for me.  What do you
 do?

Content objects are usually dull. The only thing they do is store data.
If you're using ZODB persistency, then a content object can be two lines
of code:

class MyContent(persistent.Persistent):
pass

In particular, content objects often have no methods and they definitely
don't deal with the request. This is left to views. So, somethign in
your app needs to deal with a request, write a view.

 In this case, the content object is a fax.  The fax will include browser
 views as part of it's body.

That seems like a backward approach. The fax body will probably be
rendered using other views. The body rendering view should pull in other
views. Not the fax object itself.

 I tried zapi.getView(), but this has been deprecated, and I don't quite
 understand the best approach.

Don't mix storage and presentation :).

Philipp

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


Re: [Zope3-Users] Re: How to make content object return a view?

2006-05-26 Thread David Johnson

Thanks!  You are right.  After a re-read of your book last night, I
think my problem is that I have not understood or dealt with adapters as
of yet.  It seems that is the proper solution to expressing content in
the way I intended and seems to solve all my problems in this area.

--
David
  





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