On Thu, 25 Jan 2001, Timothy Wilson wrote:

> Try adding the following to your ZClass add method:
> 
> <dtml-call "REQUEST.set('ts', ZopeTime())">
> <dtml-call "REQUEST.set('id', _.str(_.int(ts)))">
> 
> This will use the ZopeTime() as the id of your instance. I doubt you can add
> them faster enough to get the same one twice. :-)

When you add instances programatically, than you can add 2 in 1 second
without doubt. I use this python code:

def genId(client, namespace, prefix=''):
        no=int(client.ZopeTime())
        while namespace.hasattr(client, prefix+str(no)):
                no=no+1
        return prefix+str(no)

[EMAIL PROTECTED], [EMAIL PROTECTED]

/--------------------------------------\
| `long long long' is too long for GCC |
\--------------------------------------/


_______________________________________________
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