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
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" <zopist@matrixware.at> To: <zope@zope.org> 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
Hi, Francisco Here's a link to a howto on automatically generating ids. http://www.zope.org/Members/Bill/Documentation/AutoGenID You may want to look at the howto's and zope tips at http://www.zope.org/Documentation. There are a lot of answers to questions you may have there. Now, about getting unexpected authentication boxes on a new ZClass: In my experience, what you need to do is, within your ZClass's management area, go to the Define Permissions tab, and assign "Access Contents Information" to "Access Contents Information", or do something similar with whatever permissions you are having trouble with. The default has few permissions, so you need to manage these things. -- Jim Washington zopist wrote:
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
participants (3)
-
Andy McKay -
Jim Washington -
zopist