[Zope] Autogenerate id's
Paul Zwarts
paz@oratrix.com
Tue, 17 Jul 2001 16:32:24 +0200
Here's a script my colleague wrote for generating unique ids randomly. Maybe
this will help you: The import line may contain some extra stuff, so check
it because it came from a much larger script file.
Success,
Paz
from whrandom import choice
from string import join, uppercase, digits
def generateTransactionID(self):
""" Generate a unique 8 character transaction ID.
Check's uniqueness against another method (database call?)
transactions.checkTransID """
genID = lambda len: join(map(lambda i: choice(uppercase + digits),
range(len)), '')
sTID = genID(8)
while self.transactions.checkTransID(transactID=sTID):
sTID = genID(8)
return sTID
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Gitte
Wange
Sent: Tuesday, July 17, 2001 3:58 PM
To: zope@zope.org
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 )