[Zope] Re: folders with same names

Marie ROBICHON robichon@esrf.fr
Tue, 07 May 2002 09:38:20 +0200


At 02:10 02/05/02 +0000, you wrote:
>--- In zope@y..., Marie ROBICHON <robichon@e...> wrote:
> > Error Type: KeyError
> > Error Value: Parameters
>
> > Does this mean that in Zope no two folders can have the same id? This 
> would
> > cause problems when our contributors edit their parts of our site. Is 
> there
> > a way around this other than naming the folders differently?  I remember
> > seeing something about tpId somewhere....
>
>I'm having  similar problem.  I'm wanting to add an object to a container 
>with a form.  I want to check the id of the object first, to see if 
>there's already one by that name in the database.  If there is, I want to 
>send the user back to try another name.
>
>Problem is, after I pull the file ID from the REQUEST, I want to use a 
>dtml-if to check and see if it is there.  When the object turns out to not 
>be there (a good thing, for my purposes) I get a keyerror.
>
>I noticed that there's a table of parameters you can add to dtml-var, and 
>it includes a "missing" option, in case the object isn't there.  I wonder 
>if this trick works with dtml-if, as well.
>
>At any rate, we seem to be working on a similar problem.  Have you found 
>any answers yet?
>
>Dave Walker

No I haven' t found an answer to my problem yet.  I think its a problem 
with acquisition and traversal: I haven't managed to find a way to 'set' 
the absolute_url so that Zope really gives me the object I want rather than 
it resolving the object by working down to the root to get the index_html 
then working back up until it gets the first object with the name....

I remember seeing in section 1.3 of chapter 3 of Dieter Maurer's 
(excellent) book http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html
an explanation of why your problem occurs.

What happens if the user tries to create an object whose id already 
exists?  Does this raise an error anyway?  If this raises an error couldn' 
t you trap this error and get the user to try again, rather than trying to 
check if it doesn' t exist?

Getting the zen out of zope is certainly painful....and i'm hundreds of 
miles away yet...


Marie Robichon

Web Task Force
European Synchrotron Radiation Facility
BP 220
38043 Grenoble Cedex
France

http://www.esrf.fr

Tel: (33) 04 76 88 21 86
Fax: (33) 04 76 88 24 27