Commit Graph

14 Commits (75603b4082f43f87802eab8c3739eff92a634453)

Author SHA1 Message Date
martin f. krafft 460d74fa78 Handle going down with an exception
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>
2008-03-21 19:17:00 -04:00
martin f. krafft 9134145d82 put XMLStreamParser in public namespace
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>
2008-03-21 19:16:59 -04:00
martin f. krafft 17dc5df1f5 Allow individual hook registration to override ID
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>
2008-03-21 15:07:10 -04:00
martin f. krafft 86ec72c826 Refactor remote procedure calls in the proxy
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>
2008-03-21 15:07:10 -04:00
martin f. krafft 33e3528cd9 Make proxy object available to hook functions
Hook functions now get the proxy object as first argument to be able to
use RPC via the proxy.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2008-03-21 15:07:10 -04:00
martin f. krafft 5184b8abfc add last parameter to plugin registration
Signed-off-by: martin f. krafft <madduck@madduck.net>
2008-03-21 15:07:10 -04:00
martin f. krafft e3624de63c Allow external plugins to return no value
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>
2008-03-21 15:07:10 -04:00
martin f. krafft 7ab204be73 force data written to stdout to be a string
(cherry picked from commit 65c24d4aeca6188f4423ad1809f2415285843155)
2008-03-17 17:17:01 -04:00
martin f. krafft aaea01b924 Print traceback for unhandled exceptions
(cherry picked from commit 10574a324e03cd0533e77f46ead6e4c6a6e5568f)
2008-03-17 17:16:46 -04:00
Joey Hess 646392f367 rename register_hook to just hook, for consistency with the perl 2008-03-15 15:42:52 -04:00
Joey Hess 06fb2357e4 does not need to be executable 2008-03-15 15:40:10 -04:00
martin f. krafft df85743f63 improve debug output
Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit 63c7e393692b44bfa69d8b78a936f58beadef2b2)
2008-03-15 13:16:45 -04:00
martin f. krafft 1fac30a069 fix meta data
Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit 4b039b81deef852759f2aa88ae04f38d792b9bf8)
2008-03-15 13:15:44 -04:00
martin f. krafft bd4769fac4 Provide XML-RPC proxy abstraction for Python plugins
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)
2008-03-15 13:14:50 -04:00