summaryrefslogtreecommitdiffstats
path: root/util.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2011-09-28 22:23:20 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2011-09-28 22:28:12 +0200
commita537ee33121b7f43966661c37e13682524820983 (patch)
treebdf3f0408e9686e3ce3ee532973f835a5ef607e8 /util.py
parent94897110886c6af645260a39c70c244e7e69fce2 (diff)
downloadsites-a537ee33121b7f43966661c37e13682524820983.tar.gz
sites-a537ee33121b7f43966661c37e13682524820983.tar.bz2
sites-a537ee33121b7f43966661c37e13682524820983.zip
added config, externalized util
added external config file (usage from multiple own modules) externalized some functions to seperate module
Diffstat (limited to 'util.py')
-rw-r--r--util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/util.py b/util.py
index 7051134..e375aa1 100644
--- a/util.py
+++ b/util.py
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
+import config
+
+import web
from random import Random
rng = Random()
@@ -17,6 +20,15 @@ def generate_char(i, alternate_hands):
else:
return rng.choice(righthand)
+
def generate_password(length = 8, alternate_hands = True):
return ''.join([generate_char(i, alternate_hands) for i in xrange(length)])
+
+def validate_listname(name):
+ for regex in config.reserved_names:
+ if re.search(regex, name):
+ return False
+ return True
+
+