Browse Source

pylightning: Always assign the `init` method in plugin

Also fixes a crash if the doc was empty.
plugin-timeout-inc
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
025fbbc9ea
  1. 4
      contrib/pylightning/lightning/plugin.py

4
contrib/pylightning/lightning/plugin.py

@ -269,7 +269,7 @@ class Plugin(object):
# then unstash this and call it. # then unstash this and call it.
if 'init' in self.methods: if 'init' in self.methods:
self.init = self.methods['init'] self.init = self.methods['init']
self.methods['init'] = (self._init, MethodType.RPCMETHOD) self.methods['init'] = (self._init, MethodType.RPCMETHOD)
partial = "" partial = ""
for l in self.stdin: for l in self.stdin:
@ -295,12 +295,12 @@ class Plugin(object):
continue continue
doc = inspect.getdoc(func) doc = inspect.getdoc(func)
doc = re.sub('\n+', ' ', doc)
if not doc: if not doc:
self.log( self.log(
'RPC method \'{}\' does not have a docstring.'.format(name) 'RPC method \'{}\' does not have a docstring.'.format(name)
) )
doc = "Undocumented RPC method from a plugin." doc = "Undocumented RPC method from a plugin."
doc = re.sub('\n+', ' ', doc)
methods.append({ methods.append({
'name': name, 'name': name,

Loading…
Cancel
Save