def delete(self, user_id):
     logger.debug("About to delete users %s data", user_id)
     if self.has_data(user_id):
         questionnaire_state = self._get_object(user_id)
         db_session.delete(questionnaire_state)
         db_session.commit()
         logger.debug("Deleted")
Example #2
0
 def delete(self):
     logger.debug("deleting users data", user_id=self.user_id)
     if self.exists():
         questionnaire_state = self._get()
         with commit_or_rollback(db_session):
             # pylint: disable=maybe-no-member
             # session has a delete function but it is wrapped in a session_scope which confuses pylint
             db_session.delete(questionnaire_state)
 def clear(self):
     logger.debug("DatabaseSessionManager remove_user_id() - session %s", session)
     if EQ_SESSION_ID in session:
         eq_session_id = session[EQ_SESSION_ID]
         eq_session = self._get_object(eq_session_id)
         logger.debug("About to delete entry from eq_session table %s", eq_session)
         db_session.delete(eq_session)
         db_session.commit()
     else:
         logger.warning("No eq session id exists")
Example #4
0
    def clear(self):
        """
        Removes a user id from the session
        """
        logger.debug("SessionManager remove_user_id() - session %s", session)
        if EQ_SESSION_ID in session:
            eq_session_id = session[EQ_SESSION_ID]
            eq_session = self._get_user_session(eq_session_id)
            logger.debug("About to delete entry from eq_session table %s",
                         eq_session)

            with commit_or_rollback(db_session):
                # pylint: disable=maybe-no-member
                # session has a delete function but it is wrapped in a session_scope which confuses pylint
                db_session.delete(eq_session)
        else:
            logger.debug("No eq session id exists")
    def clear(self):
        """
        Removes a user id from the session
        """
        if EQ_SESSION_ID in session:
            eq_session_id = session[EQ_SESSION_ID]
            eq_session = self._get_user_session(eq_session_id)
            if eq_session is not None:
                logger.debug("deleting session from eq_session table",
                             eq_session_id=eq_session.eq_session_id,
                             user_id=eq_session.user_id,
                             timestamp=eq_session.timestamp.isoformat())

            with commit_or_rollback(db_session):
                # pylint: disable=maybe-no-member
                # session has a delete function but it is wrapped in a session_scope which confuses pylint
                db_session.delete(eq_session)
        else:
            logger.debug("no eq session id exists")