コード例 #1
0
ファイル: dao_transaction.py プロジェクト: sgiroux/synapse
    def process_request(self, req, resp):
        """
            Processes the request before routing it and starts a database
            transaction.

            :param req: The request
            :type req: falcon.Request

            :param resp: The response
            :type resp: falcon.Response
        """
        AbstractDAO.begin()
コード例 #2
0
ファイル: remote_command.py プロジェクト: sgiroux/synapse
    def run(self):
        """
            Sets up the application, runs the command, and then tears everything down
        """
        system.initialize()

        try:
            RemoteCommand.__LOGGER.debug("Starting remote command: %s", self.__command.command_key)
            AbstractDAO.begin()
            self.__command.run()
            AbstractDAO.commit()
            RemoteCommand.__LOGGER.debug("Finished remote command: %s", self.__command.command_key)
        except Exception:
            RemoteCommand.__LOGGER.exception("Error while running remote command: %s", self.__command.command_key)
            AbstractDAO.rollback()
        finally:
            system.dispose()