Re: [Zope] ZClass Confusion over object id
Hi Brian, This sounds like the DTML ZClass ID bug. Take a look at this doc: <http://www.zope.org/Members/AlexR/ZClassIDBug> HTH. Alexandre At 12:00 16/01/2000 -0800, you wrote:
Reply-To: <bhold@awod.com> From: "Brian K. Holdsworth" <bhold@awod.com> To: <zope@zope.org> Subject: [Zope] ZClass Confusion over object id Date: Sun, 16 Jan 2000 13:09:53 -0500 charset="iso-8859-1"
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.
<snip>
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
Looking over the dtml-in specs, it appears that you can sort on a particular value. For instance if I do: <dtml-in "objectValues(['DTML Document'])" sort=id> But, there doesn't appear to be a method of sorting in reverse. Is there a trick that anyone can share about how to do this, or is there already an arg that I can insert into the dtml-in to do this? Thanks, Adam -- M. Adam Kendall | mak@kha0s.org | "There's never enough time to do http://kha0s.org | all the nothing you want." | --Bill Watterson (Calvin and Hobbes)
How about <dtml-in "objectValues(['DTML Document'])" sort=id reverse> HTH Phil phil.harris@zope.co.uk |>-----Original Message----- |>From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of M. |>Adam Kendall |>Sent: Monday, January 17, 2000 4:24 PM |>To: zope@zope.org |>Subject: [Zope] dtml-in woes |> |> |>Looking over the dtml-in specs, it appears that you |>can sort on a particular value. |>For instance if I do: |> |>But, there doesn't appear to be a method of sorting |>in reverse. Is there a trick that anyone can share |>about how to do this, or is there already an arg that |>I can insert into the dtml-in to do this? |> |>Thanks, |>Adam |> |>-- |>M. Adam Kendall | |>mak@kha0s.org | "There's never enough time to do |>http://kha0s.org | all the nothing you want." |> | --Bill Watterson (Calvin and Hobbes) |> |>_______________________________________________ |>Zope maillist - Zope@zope.org |>http://lists.zope.org/mailman/listinfo/zope |>** No cross posts or HTML encoding! ** |>(Related lists - |> http://lists.zope.org/mailman/listinfo/zope-announce |> http://lists.zope.org/mailman/listinfo/zope-dev ) |>
M. Adam Kendall wrote:
Looking over the dtml-in specs, it appears that you can sort on a particular value. For instance if I do: <dtml-in "objectValues(['DTML Document'])" sort=id>
But, there doesn't appear to be a method of sorting in reverse. Is there a trick that anyone can share about how to do this, or is there already an arg that I can insert into the dtml-in to do this?
Have you tried this: - <dtml-in "objectValues(['DTML Document'])" sort=id reverse > ~Shalabh --------------------------------------------------------------- "We are all in the gutter, but some of us are looking at the stars" -Oscar Wilde ---------------------------------------------------------------
Thanks for the assistance Alexandre and Tres. Your suggestion did the trick. It seems a little odd that this appeared in 2.0.1 and is still around in 2.1.2. Does anyone know if a fix has been considered. It seems it would be pretty easy to just change the default 'add' method that gets created when a ZClass is created and avoid this pitfall. I'd volunteer to look at it, but I'm sure a more elegant solution can be thought of by those more experienced with Zope than I. Best Regards, Brian Holdsworth -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Alexandre Ratti Sent: Monday, January 17, 2000 9:44 AM To: zope@zope.org Cc: Brian K. Holdsworth Subject: Re: [Zope] ZClass Confusion over object id Hi Brian, This sounds like the DTML ZClass ID bug. Take a look at this doc: <http://www.zope.org/Members/AlexR/ZClassIDBug> HTH. Alexandre At 12:00 16/01/2000 -0800, you wrote:
Reply-To: <bhold@awod.com> From: "Brian K. Holdsworth" <bhold@awod.com> To: <zope@zope.org> Subject: [Zope] ZClass Confusion over object id Date: Sun, 16 Jan 2000 13:09:53 -0500 charset="iso-8859-1"
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.
<snip>
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
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (5)
-
Alexandre Ratti -
Brian K. Holdsworth -
M. Adam Kendall -
Phil Harris -
Shalabh Chaturvedi