Browse Source

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
master
Jan Dittberner 14 years ago
parent
commit
6d33a0e147
  1. 9
      gnuviechadmin/util/stmtcreator.py

9
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()

Loading…
Cancel
Save