[Zope-CMF] How to use the Image type in my own oject type

Tres Seaver tseaver@zope.com
Tue, 12 Mar 2002 08:15:17 -0500 (EST)


On Mon, 11 Mar 2002, Doyon, Jean-Francois wrote:

> I am try to create an object (within CMFDefault) that would have 2
> properties: a piece of text, and an image.

First, I would advise *not* editing code inside the CMFDefault
product;  you are asking for a lot of pain when we ship a new
version.  Instead, I would recommend creating your new content
type in one of the following three ways:

  - Create it as an instance of CMFDefault.SkinnedFolder, via a
    PythonScript wired up to a ScriptableTypeInformation type object.
    See my "how-to",
      <http://cmf.zope.org/Members/tseaver/how_tos/using_scriptable_type_info>

    You would then create a "normal" CMF Image and Document inside
    the SkinnedFolder, and have a presentation for the folder which
    used them.  The CMFCollector product uses this technique:  the
    "issue" is a SkinnedFolder, which contains a Document (the
    'ISSUE_TRANSCRIPT') plus other uploaded attachments.

  - Create a ZClass, derived from SkinnedFolder, and manage your image
    and text there.  Use the same presentation strategy as the first
    option.

  - Create a new content type in your own product, and manage the
    text and image as attributes (where the image could be an instance
    of OFS.Image.Image).
    
> 
> Now, for proper design, I should re-use the existing Image type either the
> CMF's , or OSF's ... I tried importing OFS.Image.Image into my object, bu
> tthen the ZMI interface gets screwed up ... I'm not sure what I'm doing
> wrong, there's lots of method in there ...
> 
> So, a) is there documentation on this object and how to properly re-use it ?
> or b) Can I smartly reference an object from another ? How could I make it
> so my object reference a CMF Image type object, other than by he URL ?
> 
> Any suggestions or help with this would be greatly appreciated !

-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.org