summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-09-10 15:12:55 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-09-10 15:12:55 +0200
commit1a55cb6a2eb8784253410b2e93510b5bcebf7f41 (patch)
treebb5fdba66bf631df529e7ad4b58724c7386ec879 /module/plugins
parentcosmetic fixed, changed default server to threaded (diff)
downloadpyload-1a55cb6a2eb8784253410b2e93510b5bcebf7f41.tar.xz
userApi for plugins
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/Base.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/module/plugins/Base.py b/module/plugins/Base.py
index 9f6499985..2b9e12653 100644
--- a/module/plugins/Base.py
+++ b/module/plugins/Base.py
@@ -88,8 +88,18 @@ class Base(object):
self.evm = core.eventManager
#: :class:`InteractionManager`
self.im = core.interactionManager
- #: :class:`User`, user related to this plugin
- self.user = user
+ if user:
+ #: :class:`Api`, user api when user is set
+ self.api = self.core.api.withUserContext(user)
+ if self.api:
+ #: :class:`User`, user related to this plugin
+ self.user = self.api.user
+ else:
+ self.api = self.core.api
+ self.user = None
+ else:
+ self.api = self.core.api
+ self.user = None
#: last interaction task
self.task = None
@@ -176,7 +186,7 @@ class Base(object):
def checkAbort(self):
""" Will be overwritten to determine if control flow should be aborted """
- if self.abort: raise Abort()
+ if self.abort(): raise Abort()
def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False):
"""Load content at url and returns it