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
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 )
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 )
On 17 Jul 2001 15:57:40 +0200, Gitte Wange wrote:
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 :-(
Try Zope.org. There is a HowTo there.
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
BWAAAHHHHHAHAHAHAH!!!! Bill
participants (4)
-
Bill Anderson -
Gitte Wange -
Paul Zwarts -
Peter Bengtsson