[Zope] ZClass based on OFS:Image Error: unsliceable object

Jim Washington jwashin@vt.edu
Fri, 13 Apr 2001 13:01:57 -0400


Hi, Stefan

You are not doing anything wrong.  Presuming you are using zope 2.3.1,
there is a known bug in ZClasses that makes createInObjectManager() not
work sometimes.  It has been fixed in CVS and will be OK again in 2.3.2.

To make it work again:

Edit your lib/python/ZClasses/ZClass.py file.

change the last line of ZClass:createInObjectManager (around line 544)
from:

return folder._getOb(i.id)

to:

return folder._getOb(i.getId())

The CVS version is a bit different, but does the same thing.

Restart Zope, and things should work OK again.

-- Jim Washington

Stefan Mallepell wrote:
> 
> Hi
> 
> I'm trying to make a extended Image ZClass. The basic idee is that I would
> like to have some more properties, like copyright, description ...
> 
> Unfortunately when I try to add such a object I get always the following
> error:
> 
> Error Type: Type Error
> Error Value: unsliceable object
> 
> What is it what I'm doing wrong? I looked for hours through image products
> which are published on www.zope.org. I also studied How To's, tutorials, The
> Zope Book and Zope Developer Guide. But I couldn't find any info to help ...
> 
> I got the same error when I tryed the How-To: ZClass Properties
> http://www.zope.org/Members/1staffor/zProperties . And this how to was very
> detailed and you can't do it wrong ... - so I really don't understand what
> it is what I'm doing wrong :(
> 
> Is there someone around who can tell me what I'm doing wrong? Please answer
> .. I'm frustrated, desperate ...
> 
> This are the definitions of my ZClass (OFS:Image)
> 
> *Property Sheet: MainProperties
> 
> *Properties: title(string), description(text), copyright(string)
> 
> *ImgClass_addForm
> 
> <HTML>
> <HEAD><TITLE>Add Extended Image</TITLE></HEAD>
> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
> <H2>Add Extended Image</H2>
> <form action="ImgClass_add" method="post" enctype="multipart/form-data">
> <table>
>   <tr>
>     <th>Id</th>
>     <td><input type=text name=id></td>
>   </tr>
>   <tr>
>     <th>Title</th>
>     <td><input type=text name=title></td>
>   </tr>
>   <tr>
>     <th valign="Top">Description</th>
>     <td><textarea name="description" rows="6" cols="35"></textarea></td>
>   </tr>
>   <tr>
>     <th>Copyright</th>
>     <td><input type=text name=copyright></td>
>   </tr>
>   <tr>
>     <td align="left" valign="top">
>       File
>     </td>
>     <td align="left" valign="top">
>       <input type="file" name="file" size="25" value="">
>     </td>
>   </tr>
>   <tr>
>     <td></td>
>     <td><input type=submit value=" Add "></td>
>   </tr>
> </table></form>
> </body></html>
> 
> *ImgClass_add
> 
> <HTML>
> <HEAD><TITLE>Add ImgClass</TITLE></HEAD>
> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
> 
> <dtml-with "ImgClass.createInObjectManager(REQUEST['id'], REQUEST)">
>   <dtml-call "propertysheets.MainProperties.manage_editProperties(REQUEST)">
> </dtml-with>
> 
> <dtml-if NoRedir>
> <dtml-else>
>   <dtml-if DestinationURL>
> 
>     <dtml-call "RESPONSE.redirect(DestinationURL+'/manage_workspace')">
> 
>   <dtml-else>
> 
>     <dtml-call "RESPONSE.redirect(URL2+'/manage_workspace')">
>   </dtml-if>
> </dtml-if>
> </body></html>