equal
deleted
inserted
replaced
24 |
24 |
25 from google.appengine.api import users |
25 from google.appengine.api import users |
26 from google.appengine.ext import db |
26 from google.appengine.ext import db |
27 |
27 |
28 from soc.cache import sidebar |
28 from soc.cache import sidebar |
|
29 from soc.logic import accounts |
29 from soc.logic.helper import notifications |
30 from soc.logic.helper import notifications |
30 from soc.logic.models import base |
31 from soc.logic.models import base |
31 from soc.logic.models.site import logic as site_logic |
32 from soc.logic.models.site import logic as site_logic |
32 |
33 |
33 import soc.models.user |
34 import soc.models.user |
70 account = users.get_current_user() |
71 account = users.get_current_user() |
71 |
72 |
72 if not account: |
73 if not account: |
73 return None |
74 return None |
74 |
75 |
75 user = self.getForFields({'account': account, 'status':'valid'}, |
76 return self.getForAccount(account) |
76 unique=True) |
|
77 |
77 |
78 return user |
78 def getForAccount(self, account): |
|
79 """Retrieves the user entity for the specified account. |
|
80 |
|
81 If there is no user logged in, or they have no valid associated User |
|
82 entity, None is returned. |
|
83 """ |
|
84 |
|
85 if not account: |
|
86 raise base.InvalidArgumentError |
|
87 |
|
88 account = accounts.normalizeAccount(account) |
|
89 |
|
90 fields = { |
|
91 'account': account, |
|
92 'status':'valid', |
|
93 } |
|
94 |
|
95 return self.getForFields(filter=fields, unique=True) |
79 |
96 |
80 def agreesToSiteToS(self, entity): |
97 def agreesToSiteToS(self, entity): |
81 """Returns indication of User's answer to the site-wide Terms of Service. |
98 """Returns indication of User's answer to the site-wide Terms of Service. |
82 |
99 |
83 Args: |
100 Args: |