83 |
83 |
84 Returns: |
84 Returns: |
85 True: no site-wide ToS is currently in effect on the site |
85 True: no site-wide ToS is currently in effect on the site |
86 True: site-wide ToS is in effect *and* User agrees to it |
86 True: site-wide ToS is in effect *and* User agrees to it |
87 (User explicitly answered "Yes") |
87 (User explicitly answered "Yes") |
88 False: site-wide ToS is in effect but User does not agree to it |
88 False: site-wide ToS is in effect but User did not agree to it yet |
89 (User explicitly answered "No") |
|
90 None: site-wide ToS in effect, but User has not answered "Yes" or "No" |
|
91 (this answer still evaluates to False, denying access to the site, |
|
92 but can be used to detect non-answer to ask the User to provide the |
|
93 missing answer) |
|
94 """ |
89 """ |
95 if not site_logic.getToS(site_logic.getSingleton()): |
90 if not site_logic.getToS(site_logic.getSingleton()): |
96 # no site-wide ToS in effect, so let the User slide for now |
91 # no site-wide ToS in effect, so let the User slide for now |
97 return True |
92 return True |
98 |
93 |
99 try: |
94 try: |
100 agrees = entity.agrees_to_tos |
95 agreed_on = entity.agreed_to_tos_on |
101 except db.Error: |
96 except db.Error: |
102 # return still-False "third answer" indicating that answer is missing |
97 # return False indicating that answer is missing |
103 return None |
98 return False |
104 |
99 |
105 # make sure the stored value is really a Boolean only |
100 # user has not agreed yet |
106 if not agrees: |
101 if not agreed_on: |
107 return False |
102 return False |
108 |
103 |
109 return True |
104 return True |
110 |
105 |
111 def getKeyValues(self, entity): |
106 def getKeyValues(self, entity): |
142 """ |
137 """ |
143 |
138 |
144 if (name == 'is_developer') and (entity.is_developer != value): |
139 if (name == 'is_developer') and (entity.is_developer != value): |
145 sidebar.flush(entity.account) |
140 sidebar.flush(entity.account) |
146 |
141 |
147 if (name == 'agrees_to_tos') and (entity.agrees_to_tos != value): |
142 if (name == 'agreed_to_tos') and (entity.agreed_to_tos != value): |
148 sidebar.flush(entity.account) |
143 sidebar.flush(entity.account) |
149 |
144 |
150 if (name == 'account') and (entity.account != value): |
145 if (name == 'account') and (entity.account != value): |
151 entity.former_accounts.append(entity.account) |
146 entity.former_accounts.append(entity.account) |
152 |
147 |