-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.py
73 lines (56 loc) · 1.7 KB
/
helper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from google.appengine.api import users
from social_models import UserProfile
import social_data
original_interest_list = [
'Music',
'Sports',
'Games',
'Books',
'Academia',
'Programming',
'Stocks'
# 'Dapping-up'
]
def get_user_profile(email):
q = UserProfile.query(UserProfile.email == email)
results = q.fetch(1)
for profile in results:
return profile
def get_user_email():
user = users.get_current_user()
if user:
return user.email()
else:
return None
def get_user_first_name(email):
q = UserProfile.query(UserProfile.email == email)
results = q.fetch(1)
for profile in results:
return profile.first_name
def get_user_last_name(email):
q = UserProfile.query(UserProfile.email == email)
results = q.fetch(1)
for profile in results:
return profile.last_name
def get_user_interest(email):
q = UserProfile.query(UserProfile.email == email)
results = q.fetch(1)
for profile in results:
return profile.interest
def get_user_check_box_values(email):
q = UserProfile.query(UserProfile.email == email)
results = q.fetch(1)
for profile in results:
return profile.check_box_valies
def get_user_friends(email):
q = UserProfile.query(UserProfile.email == email)
results = q.fetch(1)
for profile in results:
return profile.friends
def get_template_parameters():
values = {}
if get_user_email():
values['logout_url'] = users.create_logout_url('/')
else:
values['login_url'] = users.create_login_url('/')
return values