Repository: Avaiga/taipy
File: taipy/gui/gui.py (Python)

Code before:
        it was run in a separated thread: the *run_in_thread* parameter to the
        `(Gui.)run^` method was set to True, or you are running in an IPython notebook
        context.
        """
        if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server.is_running():
            self._server.stop_thread()
            self.run(**self.__run_kwargs, _reload=True)
            _TaipyLogger._get_logger().info("Gui server has been reloaded.")

    def stop(self):
        """Stop the web server.

        This function stops the underlying web server only in the situation where
        it was run in a separated thread: the *run_in_thread* parameter to the
        `(Gui.)run()^` method was set to True, or you are running in an IPython notebook
        context.
        """
        if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server.is_running():
            self._server.stop_thread()
            _TaipyLogger._get_logger().info("Gui server has been stopped.")

    def _get_authorization(self, client_id: t.Optional[str] = None, system: t.Optional[bool] = False):
        try:
            return _Hooks()._get_authorization(self, client_id, system) or contextlib.nullcontext()
        except Exception as e:
            _warn("Hooks: _get_authorization", e)
            return contextlib.nullcontext()

    def _is_exception_ignored(self, exception: Exception, source: t.Optional[str] = None) -> bool:
        try:
            return _Hooks()._is_exception_ignored(self, exception, source) or False
        except Exception as e:
            _warn("Hooks: _is_exception_ignored", e)
            return False

    def set_favicon(self, favicon_path: t.Union[str, Path], state: t.Optional[State] = None):
        """Change the favicon for all clients.

        This function dynamically changes the favicon (the icon associated with the application's
        pages) of Taipy GUI pages for a single or all connected clients.
        Note that the *favicon* parameter to `(Gui.)run()^` can also be used to change
        the favicon when the application starts.

        Arguments:
            favicon_path: The path to the image file to use.<br/>
                This can be expressed as a path name or a URL (relative or not).
            state: The state to apply the change to.<br/>
                If no set or set to None, all the application's clients are impacted.
        """
        if state or self.__favicon != favicon_path:
            if not state:

Review comment (security):
```suggestion
            _warn("Hooks._get_authorization()", e)
```

Code after:
        it was run in a separated thread: the *run_in_thread* parameter to the
        `(Gui.)run^` method was set to True, or you are running in an IPython notebook
        context.
        """
        if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server.is_running():
            self._server.stop_thread()
            self.run(**self.__run_kwargs, _reload=True)
            _TaipyLogger._get_logger().info("Gui server has been reloaded.")

    def stop(self):
        """Stop the web server.

        This function stops the underlying web server only in the situation where
        it was run in a separated thread: the *run_in_thread* parameter to the
        `(Gui.)run()^` method was set to True, or you are running in an IPython notebook
        context.
        """
        if hasattr(self, "_server") and hasattr(self._server, "_thread") and self._server.is_running():
            self._server.stop_thread()
            _TaipyLogger._get_logger().info("Gui server has been stopped.")

    def _get_authorization(self, client_id: t.Optional[str] = None, system: t.Optional[bool] = False):
        try:
            return _Hooks()._get_authorization(self, client_id, system) or contextlib.nullcontext()
        except Exception as e:
            _warn("Hooks._get_authorization()", e)
            return contextlib.nullcontext()

    def _is_exception_ignored(self, exception: Exception, source: t.Optional[str] = None) -> bool:
        if is_debugging():
            return False
        try:
            return _Hooks()._is_exception_ignored(self, exception, source) or False
        except Exception as e:
            _warn("Hooks._is_exception_ignored()", e)
            return False

    def set_favicon(self, favicon_path: t.Union[str, Path], state: t.Optional[State] = None):
        """Change the favicon for all clients.

        This function dynamically changes the favicon (the icon associated with the application's
        pages) of Taipy GUI pages for a single or all connected clients.
        Note that the *favicon* parameter to `(Gui.)run()^` can also be used to change
        the favicon when the application starts.

        Arguments:
            favicon_path: The path to the image file to use.<br/>
                This can be expressed as a path name or a URL (relative or not).
            state: The state to apply the change to.<br/>
                If no set or set to None, all the application's clients are impacted.
        """