Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Python external plugin: Catches Ikiwiki pseudo exceptions
Detail of the closed bug (discussed here [1]). Let say we have a python plugin `foo`, defining a `foo` directive, communicating with Ikiwiki unsing RPC calls. - Ikiwiki has to render a `[[!foo]]` directive, and calls the `preprocess` function of the `foo` plugin. - The `foo` plugin needs some data to handle this request, and calls an Ikiwiki function. - An error occurs (for instance, requested data is about a non-existent page), so Ikiwiki skips the current function call. Instead, it will render an error as the directive. Here, the `foo` plugin has not been notified that the `preprocess` call is cancelled, and is still waiting for its answer. - Ikiwiki has to process another `[[!foo]]` directive, and calls the `preprocess` function of `foo`. - The `foo` plugin misinterprets this request as the answer to its previous request, and the whole RPC communication is messed up. This patch corrects this, in the last item of the description, by making the `foo` plugin raise an exception if the expected answer is a new request. This exception is catched, and the request is normally handled. [1] http://ikiwiki.info/bugs/Error_with_external_plugins/
- Loading branch information