Is it possible to create *non-persistent* publishable objects with product code? I'm finding Zope unwilling to publish a generic Python object.
Is it possible to create *non-persistent* publishable objects with product code? I'm finding Zope unwilling to publish a generic Python object.
how are you trying to publish it? does it define __call__ or index_html? Those methods must have docstrings, and they must have security declarations. persistence shouldn't matter, AFAIK, but i've never tried what you are doing. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's TICK NINE-BLADED-CATFISH! (random hero from isometric.spaceninja.com)
On Friday 23 January 2004 01:17 pm, Paul Winkler wrote:
Is it possible to create *non-persistent* publishable objects with product code? I'm finding Zope unwilling to publish a generic Python object.
Yes it is possible. But it does have to have certain Zope-specific methods and attributes -- you can't do it with a generic Python object. I do this in my Narya code, which is in the CVS at: http://sourceforge.net/projects/narya-project (Follow the links to browse the CVS tree, and you can find some examples, such as PostPB in Post.py). Generally any class referred to as "FooPB" will do this in Narya. These are "Pluggable Brain"* objects that wrap database records and then establish themselves as acquisition children of the object doing the database search. This allows me to have multiple DTMLFile presentation methods for different types of objects which share an interface, for example. The interface simply specifies that it must have an "index_html", "full", "brief" presentation method, and the object decides what that should look like. A different example are the ContribMgr objects which use all class methods, and so don't need to store any persistent attributes. Look in Contribs/Contribs.py for this code. You will note that these object inherit from either Acquisition.Explicit or Acquisition.Implicit -- you will probably need that to make them useful. You will also need to define a security manager for the object. And don't forget to call Globals.InitializeClass(...)
how are you trying to publish it? does it define __call__ or index_html? Those methods must have docstrings, and they must have security declarations.
I think you can also control this by defining the "View" permission for the object, IIRC. Check the Zope Developer's Guide for more on that. I can't remember off-hand where I saw this. I've never had to use that, because it's usually simpler to just define index_html.
persistence shouldn't matter, AFAIK, but i've never tried what you are doing.
It doesn't, but note the comments above, and check out my examples if you need more information. Cheers, Terry *In concept only -- they don't use Zope's "pluggable brain" facilities which are intended for through-the-web use. Personally, I can't help thinking "Peanut Butter" everytime I see it, but what the hey. -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
On Fri, Jan 23, 2004 at 03:54:12PM -0600, Terry Hancock wrote:
On Friday 23 January 2004 01:17 pm, Paul Winkler wrote:
Is it possible to create *non-persistent* publishable objects with product code? I'm finding Zope unwilling to publish a generic Python object.
that wasn't me :-) -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's HEMI SPIFFY FISTY FIST MAN! (random hero from isometric.spaceninja.com)
participants (3)
-
nwingfield@che-llp.com -
Paul Winkler -
Terry Hancock