Commit Graph

52 Commits (eee819bad7b551c4fef920a91915eb14edc06c59)

Author SHA1 Message Date
Antoine Beaupré 154c4ea9e6 properly encode and decode from/to utf8 when sending rpc to ikiwiki
somehow, in receive this is not necessary/possible because the xml library expects strings and not unicode
2014-02-03 20:13:28 -05:00
Joey Hess 86abde54c0 Fix python proxy to not crash when fed unicode data in getstate and setstate. 2013-07-10 18:00:53 -04:00
W. Trevor King 18f16bbc30 proxy: add indexes to format strings 2012-10-10 08:07:33 -04:00
W. Trevor King 7da92e296b rst: add indexes to format strings
For Python 2.6 compatibility.  You're only allowed to omit the
positional argument specifiers in Python 2.7 and later.
2012-10-10 08:05:09 -04:00
W. Trevor King 64c98b814b proxy: convert iteritems() and and itervalues() to items() and values()
The former no longer exist in Python 3.
2012-09-29 07:18:25 -04:00
W. Trevor King 409f9341d1 proxy: don't pass arguments to format_exc() in IkiWikiProcedureProxy.run()
This avoids:

  Traceback (most recent call last):
    File "./plugins/rst", line 86, in <module>
      proxy.run()
    File "/home/wking/src/ikiwiki/plugins/proxy.py", line 316, in run
      e, traceback.format_exc(sys.exc_info()[2])))
    File "/usr/lib/python3.2/traceback.py", line 269, in format_exc
    ...
  TypeError: unorderable types: int() < traceback()

The syntax for format_exc in Python 2.x is:

  traceback.format_exc([limit])

In Python 3.x, it is:

  traceback.format_exc(limit=None, chain=True)

Neither of these need any information from sys.exc_info() passed in.
2012-09-29 07:12:59 -04:00
W. Trevor King 6e44dc1ff5 proxy: SimpleXMLRPCServer renamed to xmlrpc.server in Python 3 2012-09-29 07:03:51 -04:00
W. Trevor King e00a8f0217 proxy: xmlrpclib renamed to xmlrpc.client in Python 3 2012-09-29 07:03:51 -04:00
W. Trevor King 03bbdfa116 proxy: update string formatting and error catching syntax 2012-09-29 07:03:45 -04:00
W. Trevor King 3f4f5fc779 proxy: bump to version 0.2 2012-09-28 02:20:26 -04:00
W. Trevor King 58262a45db proxy: update copyright owners (based on the Git history) 2012-09-28 02:20:05 -04:00
W. Trevor King 792816e01d rst: update string formatting and error catching syntax 2012-09-28 02:16:29 -04:00
W. Trevor King 82fddabcec rst: bump to version 0.4 2012-09-28 02:13:37 -04:00
W. Trevor King 173db9cf87 rst: strip trailing whitespace 2012-09-28 02:13:06 -04:00
W. Trevor King 3dc8d9c024 rst: update copyright owners (based on the Git history) 2012-09-28 02:12:14 -04:00
Simon McVittie 1e81affead rst: import docutils lazily, to avoid errors during ikiwiki --setup
Bug-Debian: http://bugs.debian.org/637604
Signed-off-by: Simon McVittie <smcv@debian.org>
2011-10-22 19:46:02 +01:00
Joey Hess 30c3ceeaa2 Changed license of madduck's python plugins from GPL-2 to BSD-2-clause.
Apparently the rst library is changing to a GPL-2 incompatable license.

"madduck: joeyh: so yes, do as you think is right."
2011-05-19 14:37:16 -04:00
Joey Hess 9cee2962e0 format plugin categorization 2010-02-12 01:10:36 -05:00
Joey Hess 9f841c07df Use env hack in python scripts. 2009-12-29 15:56:25 -05:00
Joey Hess ac8ecdcf68 Support RPC::XML 0.69's incompatable object instantiation method. 2009-09-29 13:35:30 -04:00
Ulrik Sverdrup 936110ddb3 rst: Introduce _to_dict to turn argument list into keword args
(cherry picked from commit 7d788655104089b5747a5ff1a4c5106eac871c14)
2009-09-28 16:57:51 -04:00
Joey Hess e75818572f function injection overhaul
Add an inject function, that can be used by plugins that want to replace
one of ikiwiki's functions with their own version. (This is a scary thing
that grubs through the symbol table, and replaces all exported occurances
of a function with the injected version.)

external: RPC functions can be injected to replace exported functions.

Removed the stupid displaytime hook, and use injection instead.
2008-10-21 17:57:19 -04:00
Joey Hess 92a43d5d38 change example to override a real function 2008-10-21 17:09:57 -04:00
Joey Hess 68018323ae add getsetup hook
in python, even, wow
2008-08-06 01:04:45 -04:00
martin f. krafft 99bd29fc52 scan hook works, remove NotImplemented exception
Signed-off-by: martin f. krafft <madduck@madduck.net>
2008-03-21 19:17:00 -04:00
martin f. krafft 616fcc8aef Do not output xml-rpc debugging
Signed-off-by: martin f. krafft <madduck@madduck.net>
2008-03-21 19:17:00 -04:00
martin f. krafft 259d6e67a1 Flesh out pythondemo
This implements most hooks with stupid demo code, and also still has
some TODO items.

Signed-off-by: martin f. krafft <madduck@madduck.net>
2008-03-21 19:17:00 -04:00
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 32721de809 first implementation of a python demo
(cherry picked from commit bbdf127917a13b81cef50995098f479ef4fe1cf9)
2008-03-17 17:17:19 -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 e224e9cf33 fix debug method
Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit e924b6777ac0b6d04116f563f0fe749595e03d13)
2008-03-15 13:16:57 -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 7893c7ff5c remove todo comment about refactoring
Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit c6e7416f65285eba154a6a9b08c1401490f68bd1)
2008-03-15 13:15:57 -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 f91d028c47 Bump rst plugin version to 0.3
Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit 338cacc006d3b58bc827a8009e9a991b0cabf367)
2008-03-15 13:15:26 -04:00
martin f. krafft dbb4cc565d Rewrite rst plugin for Python xml-rpc proxy
Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit c877e9b4b93b550710cb26e2b0bafad4922ff209)
2008-03-15 13:14:59 -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
martin f. krafft 46976ac142 add debbug reference to SimpleXMLRPCDispatcher workaround
Signed-off-by: martin f. krafft <madduck@madduck.net>
2008-03-12 10:48:03 -04:00
martin f. krafft 8a43597a00 Handle SimpleXMLRPCDispatcher arg count change in Py2.5
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>
2008-03-12 10:46:36 -04:00
joey 65dca9f89d * Rewritten rst plugin by madduck is a python program that communicates with
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.
2007-10-15 16:33:02 +00:00
joey 27299788e8 improve comment 2007-10-13 22:32:55 +00:00