Commit 619162a11eb86fcdf2ce1b62d8543d5f9bbd938e

Authored by Miguel Barão
1 parent cb24d01a
Exists in master and in 1 other branch dev

- disabled file sessions, now sessions are in ram.

Showing 1 changed file with 18 additions and 5 deletions   Show diff stats
@@ -291,9 +291,22 @@ class Root(object): @@ -291,9 +291,22 @@ class Root(object):
291 with f: 291 with f:
292 t = json.load(f) 292 t = json.load(f)
293 return self.template['review'].render(t=t) 293 return self.template['review'].render(t=t)
294 - # FIXME  
295 - # import pdfkit  
296 - # pdfkit.from_string(r, 'out.pdf') # FIXME fails getting css, images, etc 294 +
  295 + # @cherrypy.expose FIXME
  296 + # @require(name_is('0'))
  297 + # def topdf(self, test_id):
  298 + # cookie = cherrypy.response.cookie
  299 + # print('-----------------------------------')
  300 + # print(cookie['session_id'].value)
  301 + # print('-----------------------------------')
  302 + # import pdfkit
  303 + # options = {
  304 + # 'cookie': [
  305 + # ('session_id', cookie['session_id'].value),
  306 + # ]
  307 + # }
  308 + # will not work because the session is locked, the next function cannot complete
  309 + # pdfkit.from_url(f'http://127.0.0.1:8080/review?test_id={test_id}', 'out.pdf', options=options)
297 310
298 @cherrypy.expose 311 @cherrypy.expose
299 @require(name_is('0')) 312 @require(name_is('0'))
@@ -358,8 +371,8 @@ if __name__ == '__main__': @@ -358,8 +371,8 @@ if __name__ == '__main__':
358 '/': { 371 '/': {
359 'tools.sessions.on': True, 372 'tools.sessions.on': True,
360 'tools.sessions.timeout': 240, # sessions last 4 hours 373 'tools.sessions.timeout': 240, # sessions last 4 hours
361 - 'tools.sessions.storage_type': 'file', # 'ram' or 'file'  
362 - 'tools.sessions.storage_path': 'sessions', # if storage_type='file' 374 + 'tools.sessions.storage_type': 'ram', # 'ram' or 'file'
  375 + # 'tools.sessions.storage_path': 'sessions', # if storage_type='file'
363 # tools.sessions.secure = True 376 # tools.sessions.secure = True
364 # tools.sessions.httponly = True 377 # tools.sessions.httponly = True
365 378