MCPcopy Index your code
hub / github.com/rawpython/remi / renew_session

Method renew_session

examples/session_app.py:148–165  ·  view source on GitHub ↗

Have to be called on user actions to check and renew session

(self)

Source from the content-addressed store, hash-verified

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
168class MyApp(App):

Callers 2

on_loginMethod · 0.80
on_renewMethod · 0.80

Calls 3

on_session_expiredMethod · 0.95
set_cookieMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected