From 48c0c42fd6faffc56432d5f037cd575979f180cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 02:23:37 +0200 Subject: Removed all @author flags + key attributes cleanup for internal & hooks plugins --- module/plugins/hooks/MultiHome.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index b1635a588..5a7e53b0d 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - - @author: mkaay """ from time import time @@ -25,12 +23,16 @@ from module.plugins.Hook import Hook class MultiHome(Hook): __name__ = "MultiHome" __version__ = "0.11" - __description__ = """Ip address changer""" + __type__ = "hook" + __config__ = [("activated", "bool", "Activated", False), ("interfaces", "str", "Interfaces", "None")] + + __description__ = """Ip address changer""" __author_name__ = "mkaay" __author_mail__ = "mkaay@mkaay.de" + def setup(self): self.register = {} self.interfaces = [] -- cgit v1.2.3 From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/hooks/MultiHome.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 5a7e53b0d..31bbbcc9a 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -73,6 +73,7 @@ class MultiHome(Hook): class Interface(object): + def __init__(self, adress): self.adress = adress self.history = {} -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hooks/MultiHome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 31bbbcc9a..b9c663046 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -38,7 +38,7 @@ class MultiHome(Hook): self.interfaces = [] self.parseInterfaces(self.getConfig("interfaces").split(";")) if not self.interfaces: - self.parseInterfaces([self.config["download"]["interface"]]) + self.parseInterfaces([self.config['download']['interface']]) self.setConfig("interfaces", self.toConfig()) def toConfig(self): -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hooks/MultiHome.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index b9c663046..e2167b65e 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -""" - from time import time from module.plugins.Hook import Hook @@ -22,8 +7,8 @@ from module.plugins.Hook import Hook class MultiHome(Hook): __name__ = "MultiHome" - __version__ = "0.11" __type__ = "hook" + __version__ = "0.11" __config__ = [("activated", "bool", "Activated", False), ("interfaces", "str", "Interfaces", "None")] -- cgit v1.2.3 From 0d220d634e512d89bda540f91c643b361c82ea8a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Sep 2014 01:38:32 +0200 Subject: Logging string cosmetics --- module/plugins/hooks/MultiHome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index e2167b65e..418dfde71 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -44,7 +44,7 @@ class MultiHome(Hook): if iface: iface.useFor(pluginName, account) requestFactory.iface = lambda: iface.adress - self.logDebug("Multihome: using address: " + iface.adress) + self.logDebug("Using address", iface.adress) return oldGetRequest(pluginName, account) requestFactory.getRequest = getRequest -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hooks/MultiHome.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 418dfde71..7f223d2b0 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -14,8 +14,7 @@ class MultiHome(Hook): ("interfaces", "str", "Interfaces", "None")] __description__ = """Ip address changer""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def setup(self): -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hooks/MultiHome.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 7f223d2b0..5cda53bd7 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -14,6 +14,7 @@ class MultiHome(Hook): ("interfaces", "str", "Interfaces", "None")] __description__ = """Ip address changer""" + __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/hooks/MultiHome.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 5cda53bd7..378c493e9 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -26,19 +26,23 @@ class MultiHome(Hook): self.parseInterfaces([self.config['download']['interface']]) self.setConfig("interfaces", self.toConfig()) + def toConfig(self): return ";".join([i.adress for i in self.interfaces]) + def parseInterfaces(self, interfaces): for interface in interfaces: if not interface or str(interface).lower() == "none": continue self.interfaces.append(Interface(interface)) + def coreReady(self): requestFactory = self.core.requestFactory oldGetRequest = requestFactory.getRequest + def getRequest(pluginName, account=None): iface = self.bestInterface(pluginName, account) if iface: @@ -49,6 +53,7 @@ class MultiHome(Hook): requestFactory.getRequest = getRequest + def bestInterface(self, pluginName, account): best = None for interface in self.interfaces: @@ -63,13 +68,16 @@ class Interface(object): self.adress = adress self.history = {} + def lastPluginAccess(self, pluginName, account): if (pluginName, account) in self.history: return self.history[(pluginName, account)] return 0 + def useFor(self, pluginName, account): self.history[(pluginName, account)] = time() + def __repr__(self): return "" % self.adress -- cgit v1.2.3 From 885f8ed782e64d9e73367905e642a84d0a8999f1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 04:01:38 +0100 Subject: Update __config__ --- module/plugins/hooks/MultiHome.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 378c493e9..d71e5800a 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -10,8 +10,7 @@ class MultiHome(Hook): __type__ = "hook" __version__ = "0.11" - __config__ = [("activated", "bool", "Activated", False), - ("interfaces", "str", "Interfaces", "None")] + __config__ = [("interfaces", "str", "Interfaces", "None")] __description__ = """Ip address changer""" __license__ = "GPLv3" -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hooks/MultiHome.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index d71e5800a..228e6027d 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -6,15 +6,15 @@ from module.plugins.Hook import Hook class MultiHome(Hook): - __name__ = "MultiHome" - __type__ = "hook" + __name__ = "MultiHome" + __type__ = "hook" __version__ = "0.11" __config__ = [("interfaces", "str", "Interfaces", "None")] __description__ = """Ip address changer""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def setup(self): -- cgit v1.2.3 From e4c9e4ffc9e3f6bd6b16ce83796dc3d275d544f7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 9 Dec 2014 01:13:05 +0100 Subject: Don't start unused periodical in some addons --- module/plugins/hooks/MultiHome.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'module/plugins/hooks/MultiHome.py') diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 228e6027d..105a42abd 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class MultiHome(Hook): __name__ = "MultiHome" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __config__ = [("interfaces", "str", "Interfaces", "None")] @@ -17,6 +17,11 @@ class MultiHome(Hook): __authors__ = [("mkaay", "mkaay@mkaay.de")] + #@TODO: Remove in 0.4.10 + def initPeriodical(self): + pass + + def setup(self): self.register = {} self.interfaces = [] -- cgit v1.2.3