summaryrefslogtreecommitdiff
path: root/portato/plugin.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/plugin.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/portato/plugin.py b/portato/plugin.py
index 9d86414..cfe3d93 100644
--- a/portato/plugin.py
+++ b/portato/plugin.py
@@ -13,14 +13,12 @@
"""
A module managing the plugins for Portato.
"""
-
-from __future__ import absolute_import
__docformat__ = "restructuredtext"
import os
import os.path as osp
import traceback
-from collections import defaultdict
+from collections import defaultdict, Callable
from functools import wraps
from . import helper
@@ -329,7 +327,7 @@ class WidgetPlugin (Plugin):
"""
if not slot in WidgetSlot.slots:
- raise PluginLoadException, "Could not find specified widget slot: %s" % slot
+ raise PluginLoadException("Could not find specified widget slot: %s" % slot)
self.__widgets.append(Widget(slot, widget))
@@ -352,14 +350,14 @@ class WidgetPlugin (Plugin):
try:
widget = WidgetSlot.slots[slot].widget
except KeyError:
- raise PluginLoadException, "Could not find specified widget slot: %s" % slot
+ raise PluginLoadException("Could not find specified widget slot: %s" % slot)
if not hasattr(args, "__iter__"):
w = widget(args)
else:
w = widget(*args)
- for k,v in kwargs.iteritems():
+ for k,v in kwargs.items():
w.connect(k, v)
self.add_widget(slot, w)
@@ -441,8 +439,8 @@ class PluginQueue (object):
for p in plugins: # import them
try:
- exec "from portato.plugins import %s" % p in {}
- except PluginLoadException, e:
+ exec("from portato.plugins import %s" % p, {})
+ except PluginLoadException as e:
error(_("Loading plugin '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : e})
except:
tb = traceback.format_exc()
@@ -455,7 +453,7 @@ class PluginQueue (object):
if isinstance(p, WidgetPlugin):
try:
p._widget_init(window)
- except PluginLoadException, e:
+ except PluginLoadException as e:
error(_("Loading plugin '%(plugin)s' failed: %(error)s"), {"plugin" : p, "error" : e})
except:
tb = traceback.format_exc()
@@ -480,14 +478,14 @@ class PluginQueue (object):
:raise PluginLoadException: passed plugin is not of class `Plugin`
"""
- if callable(plugin) and issubclass(plugin, Plugin):
+ if isinstance(plugin, Callable) and issubclass(plugin, Plugin):
p = plugin(disable = disable) # need an instance and not the class
elif isinstance(plugin, Plugin):
p = plugin
if disable:
p.status = p.STAT_HARD_DISABLED
else:
- raise PluginLoadException, "Is neither a subclass nor an instance of Plugin."
+ raise PluginLoadException("Is neither a subclass nor an instance of Plugin.")
p._init()
@@ -606,10 +604,10 @@ class PluginQueue (object):
self._resolve_unresolved(unresolved_before, unresolved_after)
- for hook, calls in star_before.iteritems():
+ for hook, calls in star_before.items():
self.hooks[hook].before.extend(calls) # append the list
- for hook, calls in star_after.iteritems():
+ for hook, calls in star_after.items():
self.hooks[hook].after.extend(calls) # append the list
def _resolve_unresolved (self, before, after):
@@ -700,7 +698,7 @@ def register (plugin, disable = False):
if __plugins is not None:
try:
__plugins.add(plugin, disable)
- except PluginLoadException, e:
+ except PluginLoadException as e:
error(_("Registrating plugin '%(plugin)s' failed: %(error)s"), {"plugin" : plugin, "error" : e})
except:
tb = traceback.format_exc()
-10Switch to our own html2text fork for the time beingRené 'Necoro' Neumann3-5/+5 2020-05-10Text part in emailsRené 'Necoro' Neumann7-33/+115 2020-05-10Allow options on group level.René 'Necoro' Neumann3-5/+11 Closes #12. 2020-05-10Renamed feed template to html templateRené 'Necoro' Neumann2-2/+2 2020-05-10Release v0.2.0v0.2.0René 'Necoro' Neumann2-2/+6 2020-05-10Fix building cacheRené 'Necoro' Neumann1-1/+3 2020-05-10Update READMERené 'Necoro' Neumann1-5/+44 2020-05-10Ignore 'dist' folder and build productsRené 'Necoro' Neumann1-0/+2 2020-05-08Print item hashes in debug modeRené 'Necoro' Neumann1-1/+7 2020-05-07Improve html renderingRené 'Necoro' Neumann2-53/+32 2020-05-07Do not assume items to be new when their published date is newer than the ↵René 'Necoro' Neumann2-7/+1 last run 2020-05-07Updating some depsRené 'Necoro' Neumann2-2/+7 2020-05-07Better detection if a text starts with html or notRené 'Necoro' Neumann2-4/+13 2020-05-07go fmtRené 'Necoro' Neumann1-3/+2 2020-05-07Add header X-Feed2Imap-GUIDRené 'Necoro' Neumann3-1/+7 2020-05-07update changelogRené 'Necoro' Neumann1-0/+1 2020-05-07FixRené 'Necoro' Neumann1-1/+1 2020-05-07Unified publishedDate and updatedDate into one (just as the old feed2imap...)René 'Necoro' Neumann5-21/+32 2020-05-06Print version during startupRené 'Necoro' Neumann1-1/+1 2020-05-06Improve templateRené 'Necoro' Neumann3-20/+28 2020-05-05Fix pipelineRené 'Necoro' Neumann1-2/+5 2020-05-05Make changelog a part of the release pipeline (untested)René 'Necoro' Neumann2-0/+12