[Zope-dev] Z Classes and contained objects

Josh Zeidner jmz_phylogenic@hotmail.com
Sat, 31 Jul 1999 14:57:07 EDT


> >
> >   Currently, I am working with ZClasses with a "contained" image object. 
>  In
> > other words, I created an Image object in the "method" screen.  I also
> > created an "image" upload view that performs one simple function, 
>uploads an
> > image.
> >
>
>By putting a Zope image object in the ZClass definition, you are
>defining a class attribute, NOT an instance attribute.  Changing this
>object will change the attribute for all instances.
>
>To instanciate a new image object in your instances, add DTML like:
>
><!--#call manage_addImage(id_of_image, image_file)-->

  I do not necessarily want to be able to add an image to my ZClass 
Instance.  I want one image to be available to each instance of a ZClass, 
and for that image to be an attribute called medium-pic.  From what I 
gather, I cannot simply add the image through the method tab, but must call 
the above DTML method to have this image act normally.  Keep in mind what I 
have done does occasionally work, but is inconsistent.

>in the ZClass constructor (which is usualy a peer object of the ZClass,
>not subordinate).  Note that if you add your ZClasses programaticly
>(from an external method) and you don't call the constructor, you will
>need to simulate what the constructor does.  This is an uncommon need,
>however.
>
> >   The problem may lie in the way I am uploading this image.  Here is the
> > line of code that I got from a Zope Doc :
> >
> > medium_pic.manage_upload(REQUEST['new_pic'])
> >
> >   The symptoms of this bug are either inconsistently broken images when
> > viewing the object or distorted images( the image is not retaining its
> > aspect ratio ).
> >
>
>Hmmm.. This might be because several threads are trying to access the
>same class attribute at once.  But I don't really know.

  Is there a bug report I should put this through?

>
>-Michel


_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com