def is_session_stale(self, conn, session_id): cherrypy.log('Hello from is_session_stale', severity=logging.DEBUG) result = execute_fetchone( conn, FetchController.is_session_stale_query, { 'ses_id': session_id }) cherrypy.log(pformat(result), severity=logging.DEBUG) return result['result'][0]
def update_existing_session(self, conn, session_id, tag): cherrypy.log('Hello from update_existing_session', severity=logging.DEBUG) temp = execute_fetchone( conn, FetchController.update_existing_session_query, { 'tag': tag, 'ses_id': session_id }) conn.commit() cherrypy.log(pformat(temp), severity=logging.DEBUG) return Session.from_db_row(temp['result'])
def get_existing_session(self, conn, session_key, session_type): cherrypy.log('Hello from get_existing_session', severity=logging.DEBUG) session_type_result = execute_fetchone( conn, FetchController.session_type_query, { 'ses_type': session_type } ) cherrypy.log(pformat(session_type_result), severity=1) if session_type_result['result'] is None: raise cherrypy.HTTPError(400, 'Invalid session type') existing_session_result = execute_fetchone( conn, FetchController.existing_session_query, { 'ses_type_id': session_type_result['result']['session_type_id'], 'ses_key': session_key, } ) cherrypy.log(pformat(existing_session_result), severity=1) return existing_session_result['result']
def update_session_tag(self, conn, session_type, session_key, tag): cherrypy.log('Hello from update_session_tag', severity=logging.DEBUG) temp = execute_fetchone( conn, UpdateTagController.update_session_tag_query, { 'tag': tag, 'ses_type': session_type, 'ses_key': session_key }) conn.commit() cherrypy.log(pformat(temp), severity=logging.DEBUG) return Session.from_db_row(temp['result'])
def recreate_session(self, conn, session_id, session_key, session_type, tag): cherrypy.log('Hello from recreate_session', severity=logging.DEBUG) session_string = self.make_session_string() execute_only(conn, FetchController.delete_session_query, { 'ses_id': session_id }) temp = execute_fetchone( conn, FetchController.new_session_query, { 'ses_key': session_key, 'ses_str': session_string, 'ses_type': session_type, 'tag': tag }) conn.commit() cherrypy.log(pformat(temp), severity=logging.DEBUG) return Session.from_db_row(temp['result'])