def _genPwd(): import random, string passwd = "" chars = string.ascii_lowercase for x in range(3): nr = 95 while chr(nr) not in chars: nr = random.randint(65,122) passwd += chr(nr) return passwd+str(int(random.random()*10))+str(int(random.random()*10))+str(int(random.random()*10)) def cookString(text): """ Make a Zope-friendly ID from 'text'. o Remove any spaces o Lowercase the ID. """ rgx = re.compile(r'(^_|[^a-zA-Z0-9-_~\,\.])') cooked = re.sub(rgx, "",text).lower() return cooked