[Zope] ZClass Confusion over object id
Tres Seaver
tseaver@palladion.com
Sun, 16 Jan 2000 17:09:25 -0600
"Brian K. Holdsworth" <bhold@awod.com> wrote:
> I have embarked on my first effort to create a custom ZClass for a site
> I am building. It almost works! The problem has something to do with the
> way the object "id" gets created when I make an instance of my custom ZClass.
> I am using Zope 2.1.2 and my ZClass inherits from DTML Document. I upgraded
> to the latest version hoping it would fix the problem. It didn't, so I
> assume now that I am doing something wrong.
>
> Here is what I am using for my addForm method:
>
> <HTML>
> <HEAD><TITLE>Add Article</TITLE></HEAD>
> <BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555">
> <H2>Add Article</H2>
> <form action="ArticleClass_add"><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>Author:</th>
> <td><input type=text name="author"></td>
> </tr>
> <tr><th>Summary:</th>
> <td><textarea name="synopisis" cols="40" rows="10"></textarea></td>
> </tr>
> <tr><td></td><td><input type=submit value=" Add "></td></tr>
> </table></form>
> </body></html>
>
> The title, author, and synopsis properties are added to my ZClass on a
> property sheet called "article_info". I include these lines in my add
> method so that the properties can be filled in at object creation time:
>
> <!--#with "ArticleClass.createInObjectManager(REQUEST['id'], REQUEST)"-->
> <!--#call "propertysheets.article_info.manage_editProperties(
> REQUEST)"-->
> <!--#/with-->
>
> The basic problem is that when I create an instance, the "id" property ends
> up blank! I see the object in the manage GUI with its id, but when I try to
> access the "id" of the instance in DTML, I get a value of "<string>" instead
> of the id I assigned. The other properties, like title and author, get
> created correctly. The edit page for the new object instance (it is a
> sub-class of DTML Document) also displays a blank id.
>
> Any clues???
>
> Brian Holdsworth
There is a How-To addressed specifically to working around this problem:
http://www.zope.org/Members/AlexR/ZClassIDBug
Best,
Tres.
--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com