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
This commit is contained in:
parent
1d288681b7
commit
6d33a0e147
1 changed files with 6 additions and 3 deletions
|
@ -23,12 +23,15 @@
|
||||||
"""This is an SQL statement creator as a prototype for mail account
|
"""This is an SQL statement creator as a prototype for mail account
|
||||||
creation."""
|
creation."""
|
||||||
|
|
||||||
if __name__ == '__main___':
|
if __name__ == '__main__':
|
||||||
from passwordutils import *
|
from passwordutils import get_pw_tuple
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
for line in sys.stdin.read().splitlines():
|
for line in sys.stdin.readlines():
|
||||||
parts = line.split()
|
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("@")
|
(email, domain) = parts[0].split("@")
|
||||||
username = parts[1][0:5]
|
username = parts[1][0:5]
|
||||||
pwtuple = get_pw_tuple()
|
pwtuple = get_pw_tuple()
|
||||||
|
|
Loading…
Reference in a new issue