]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/util.py
Rewrite parametrize to use new parametrizeWithVars
[wizard.git] / wizard / util.py
index 1c884035af4e04562488301e75d164fa6cd9e848..6c9764d317d88d4dd8f6f05b4546d91778665ec4 100644 (file)
@@ -19,6 +19,8 @@ import httplib
 import urllib
 import time
 import logging
+import random
+import string
 
 import wizard
 
@@ -372,6 +374,10 @@ def mixed_newlines(filename):
     f.close() # just to be safe
     return ret
 
+def random_key(length=30):
+    """Generates a random alphanumeric key of ``length`` size."""
+    return ''.join(random.choice(string.letters + string.digits) for i in xrange(length))
+
 class NoOperatorInfo(wizard.Error):
     """No information could be found about the operator from Kerberos."""
     pass