[Zope] Autogenerate id's

Peter Bengtsson mail@peterbe.com
Tue, 17 Jul 2001 16:19:21 +0200


There really isn't one to do that. You'll have to do it yourself.
Search for the ThreadSafeCounter product.
A lot of products use the current date and time to generate a string of the
timestamp.

I for one use this:
import string
def generateRandomMessageId(length=10):
    pool=string.lowercase+string.uppercase
    id=[]
    for i in range(length):
        id.append(pool[randint(0,len(pool)-1)])
    return string.join(id,'')

in one of my products.

Peter

----- Original Message -----
From: "Gitte Wange" <gitte@mmmanager.org>
To: <zope@zope.org>
Sent: Tuesday, July 17, 2001 3:57 PM
Subject: [Zope] Autogenerate id's


> Hello,
>
> I was wondering if any of you had created any scripts in order to create
an
> auto-generated ID ?
>
> Tried to find it in the archives, but found nothing :-(
>
> Regards,
>
> --
> Gitte Wange Jensen
>
> Sys Admin, Developer and a lot more
> MMmanager.org Aps, Denmark
>
> Phone: +45 29 72 79 72
> Email: gitte@mmmanager.org
> Web: www.mmmanager.org
>
> Quote of the day:
> Ok, the guy who made the netfilter Makefile was probably on some
> really interesting and probably highly illegal drugs when he wrote it.
> - Linus Torvalds
>
> _______________________________________________
> 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 )