From 6d33a0e1473ff0ffd5d2dcba1caf1315a2650b78 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Mon, 7 Apr 2008 17:13:17 +0000 Subject: [PATCH] improve stmtcreator * fix __main__ spelling (fixes #15) * raise a ValueError for wrong lines and explain the correct syntax git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/trunk@255 a67ec6bc-e5d5-0310-a910-815c51eb3124 --- gnuviechadmin/util/stmtcreator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gnuviechadmin/util/stmtcreator.py b/gnuviechadmin/util/stmtcreator.py index 9e5270f..7cae25c 100644 --- a/gnuviechadmin/util/stmtcreator.py +++ b/gnuviechadmin/util/stmtcreator.py @@ -23,12 +23,15 @@ """This is an SQL statement creator as a prototype for mail account creation.""" -if __name__ == '__main___': - from passwordutils import * +if __name__ == '__main__': + from passwordutils import get_pw_tuple import sys - for line in sys.stdin.read().splitlines(): + for line in sys.stdin.readlines(): parts = line.split() + if len(parts) < 4: + raise ValueError("""lines must consist of the elements: +email@domain username uid domainid""") (email, domain) = parts[0].split("@") username = parts[1][0:5] pwtuple = get_pw_tuple()