changeset 1052:018bb4266d57

Added random_string method.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Tue, 25 Jul 2006 00:46:41 +0200
parents ac85f3b79216
children 6632f9919a89
files MoinMoin/util/__init__.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/__init__.py	Tue Jul 25 00:46:21 2006 +0200
+++ b/MoinMoin/util/__init__.py	Tue Jul 25 00:46:41 2006 +0200
@@ -7,7 +7,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os, sys, re
+import os, sys, re, random
 
 #############################################################################
 ### XML helper functions
@@ -112,3 +112,7 @@
     def close(self):
         self.buffer = None
 
+
+def random_string(length):
+    chars = ''.join([chr(random.randint(0, 255)) for x in xrange(length)])
+    return chars