We previously used None as a sentinel to exit, but None is now a proper
value, so now it's the job of an exception-like object (except it isn't
an exception).
Signed-off-by: martin f. krafft <madduck@madduck.net>
Since we might throw sub-class exceptions, the class should be in the
public namespace, meaning its name should not be prefixed with _.
Signed-off-by: martin f. krafft <madduck@madduck.net>
The preprocessor hooks need to specify IDs different from the ID used to
initialise the proxy. Thus, the hook function now takes an optional id
keyword argument and uses the ID used during initialisation if none is
provided.
Signed-off-by: martin f. krafft <madduck@madduck.net>
Add an rpc() method to the proxy to allow users to call remote
procedures, and route the proxy's own import registration via this
function.
Also, implement convenience functions for the RPC calls exported in the
IkiWiki::XML::RPC namespace.
Signed-off-by: martin f. krafft <madduck@madduck.net>
Instead of using the XML-RPC v2 extension <nil/>, which Perl's
XML::RPC::Parser does not (yet) support (Joey's patch is pending), we
agreed on a sentinel: {'null':''}, that is, a hash with a single key
"null" pointing to the empty string.
The Python proxy automatically converts None appropriately and raises an
exception if a hook function should, by weird coincidence, attempt to
return {'null':''}.
Signed-off-by: martin f. krafft <madduck@madduck.net>
The proxy module provides an abstraction to facilitate writing ikiwiki
plugins in Python.
Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit f347e83d82f26cdc59de17b754a78db58a933ea6)
SimpleXMLRPCDispatcher.__init__ takes 3 arguments instead of 1 since
python 2.5, so we check for that with a hack, for I found no better way,
other than catching a TypeError exception.
Signed-off-by: martin f. krafft <madduck@madduck.net>
ikiwiki via XML RPC. This should be much faster than the old plugin that
had to fork python for every rst page render. Note that if you use
the rst plugin, you now need to have the RPC::XML perl module installed.