#!/usr/bin/python
# -*- coding: utf-8 -*-
#
-# xmlrpc — helper for Python-based external (xml-rpc) ikiwiki plugins
+# proxy.py — helper for Python-based external (xml-rpc) ikiwiki plugins
#
# Copyright © martin f. krafft <madduck@madduck.net>
# Released under the terms of the GNU GPL version 2
#
-__name__ = 'xmlrpc'
-__description__ = 'xml-rpc-based ikiwiki plugin to process RST files'
+__name__ = 'proxy.py'
+__description__ = 'helper for Python-based external (xml-rpc) ikiwiki plugins'
__version__ = '0.1'
__author__ = 'martin f. krafft <madduck@madduck.net>'
__copyright__ = 'Copyright © ' + __author__
@staticmethod
def _write(out_fd, data):
- out_fd.write(data)
+ out_fd.write(str(data))
out_fd.flush()
@staticmethod
def send_rpc(self, cmd, in_fd, out_fd, **kwargs):
xml = xmlrpclib.dumps(sum(kwargs.iteritems(), ()), cmd)
- self._debug_fn('sending xml to ikiwiki to call procedure %s: [%s]' % (cmd, xml))
+ self._debug_fn("calling ikiwiki procedure `%s': [%s]" % (cmd, xml))
_IkiWikiExtPluginXMLRPCHandler._write(out_fd, xml)
self._debug_fn('reading response from ikiwiki...')
self._xmlrpc_handler = _IkiWikiExtPluginXMLRPCHandler(self._debug_fn)
self._xmlrpc_handler.register_function(self._importme, name='import')
- def register_hook(self, type, function):
+ def hook(self, type, function):
self._hooks.append((type, function.__name__))
self._xmlrpc_handler.register_function(function)
return
time.sleep(LOOP_DELAY)
except Exception, e:
- self._debug_fn('uncaught exception: %s' % e)
+ print >>sys.stderr, 'uncaught exception: %s' % e
+ import traceback
+ print >>sys.stderr, traceback.format_exc(sys.exc_info()[2])
+ import posix
sys.exit(posix.EX_SOFTWARE)