There are many different options one simple way I used at the beginning was
to base it on date and time:

<dtml-call "REQUEST.set('id','Faqs'+_.str(_.int(ZopeTime())))">
<dtml-with "Faqs.createInObjectManager(REQUEST['id'], REQUEST)">

...

This creates an id along the lines of Faqs958889275

----- Original Message -----
From: "zopist" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 15, 2000 11:09 AM
Subject: [Zope] How to generate an Object ID automatically


dear zopists,
im a zope newbie and i have one of those little problems ppl like me can
spend hours on ...
i just built my first ZClass and now im trying to automatically assign a
generated ID to an instance of this class in the -add method.
i want to generate the id because there is no unique fieldvalue available
and i dont want to have the users get stuck on this point.

another problem i encountered is that when i try to add an instance in a
folder i get an authentication box where no valid login is accepted

i would really much apreciate if someone could help.

Francisco (chico) Webber


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to