Workout With Friends
Stay fit with a little motivation
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Properties
wowf
scripts
adduser.py
Go to the documentation of this file.
1
import
transaction
2
from
getpass
import
getpass
3
from
wowf.lib.auth
import
Auth
4
from
wowf.models
import
User
5
from
wowf.scripts
import
BaseCommand, make_main
6
7
8
class
AddUserCommand
(
BaseCommand
):
9
10
def
run
(self):
11
transaction.begin()
12
while
True
:
13
username = raw_input(
'Username: '
)
14
email = raw_input(
'Email: '
)
15
while
True
:
16
gender = raw_input(
'Gender (M/F): '
)
17
if
gender
not
in
(
'M'
,
'F'
):
18
print
'Gender must be M or F!'
19
else
:
20
break
21
while
True
:
22
password1 = getpass(
'Password: '
)
23
password2 = getpass(
'Repeat password: '
)
24
if
password1 != password2:
25
print
"Passwords don't match!"
26
else
:
27
break
28
user = User.create(username, email, password1, gender, dob, weight, height)
29
Auth.register(user, login=
False
)
30
again = raw_input(
'Add another user ([y]/n)? '
)
31
if
again.upper() ==
'N'
:
32
break
33
transaction.commit()
34
35
36
main =
make_main
(AddUserCommand)
37
Generated on Sat Dec 15 2012 14:59:09 for Workout With Friends by
1.8.1.2