Have to be called on user actions to check and renew session
(self)
| 146 | return () |
| 147 | |
| 148 | def renew_session(self): |
| 149 | """Have to be called on user actions to check and renew session |
| 150 | """ |
| 151 | if ((not 'user_uid' in self.cookieInterface.cookies) or self.cookieInterface.cookies['user_uid']!=self.session_uid) and (not self.expired): |
| 152 | self.on_session_expired() |
| 153 | |
| 154 | if self.expired: |
| 155 | self.session_uid = str(random.randint(1,999999999)) |
| 156 | |
| 157 | self.cookieInterface.set_cookie('user_uid', self.session_uid, str(self.session_timeout_seconds)) |
| 158 | |
| 159 | #here we renew the internal timeout timer |
| 160 | if self.timeout_timer: |
| 161 | self.timeout_timer.cancel() |
| 162 | self.timeout_timer = threading.Timer(self.session_timeout_seconds, self.on_session_expired) |
| 163 | self.timeout_timer.daemon = True |
| 164 | self.expired = False |
| 165 | self.timeout_timer.start() |
| 166 | |
| 167 | |
| 168 | class MyApp(App): |
no test coverage detected