[Zope] Checking for ID's before creating ZClass

Andy McKay andym@ActiveState.com
Tue, 7 Nov 2000 12:41:56 -0800


Perhaps it might be easier just to generate one you know will be unique, eg
date-time or use a counter. Anyway <dtml-in "objectIds()"> should give you a
list of ids of the current folder where the object is being created.

--
  Andy McKay, Developer.
  ActiveState.

----- Original Message -----
From: "Ivan Cornell" <ivan.cornell@framestore.co.uk>
To: <zope@zope.org>
Sent: Tuesday, November 07, 2000 10:45 AM
Subject: [Zope] Checking for ID's before creating ZClass


> Hello from rainy England,
>
> In my constructor for a ZClass I want to auto generate an ID consisting
> of a name followed by a incrementing sequence (port0, port1, port2...).
> How do I check for all existing id's in a folder? I tried doing it in a
> PythonMethod (or whatever they are called now!), calling hasattr() but
> failed. Another possibilty would be to loop on a
> try..<createInObject>..raise until successful, but that doesn't seem
> very zopish. In the source code for createInObjectManager I can see it
> getting the folder, but can't figure how to acheive that directly,
>
> Ivan
>
>
> _______________________________________________
> 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 )
>