From b05706efd5205ec0a492eafe193b5bf4498e3316 Mon Sep 17 00:00:00 2001 From: GammaC0de Date: Tue, 13 Oct 2015 23:04:45 +0300 Subject: [UpdateManager] report 404 --- module/plugins/hooks/UpdateManager.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index caebdaa9b..876849953 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -16,7 +16,7 @@ from module.utils import fs_encode, save_join as fs_join class UpdateManager(Addon): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "1.00" + __version__ = "1.01" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , True ), @@ -278,6 +278,7 @@ class UpdateManager(Addon): 'name': n, }) + req = self.pyload.requestFactory.getRequest(self.classname) for plugin in updatelist: name = plugin['name'] type = plugin['type'] @@ -300,9 +301,12 @@ class UpdateManager(Addon): 'oldver': oldver, 'newver': newver}) try: - content = self.load(url % plugin + ".py", decode=False) - m = self._VERSION.search(content) + content = self.load(url % plugin + ".py", decode=False, req=req) + if req.code == 404: + raise Exception(_("Plugin URL not found (404)")) + + m = self._VERSION.search(content) if m and m.group(2) == version: #@TODO: Remove in 0.4.10 if type in ("account", "hook"): @@ -315,7 +319,7 @@ class UpdateManager(Addon): updated.append((type, name)) else: - raise Exception(_("Version mismatch")) + raise Exception(_("Plugin version mismatch")) except Exception, e: self.log_error(_("Error updating plugin: %s %s") % (type.upper(), name), e) @@ -372,7 +376,7 @@ class UpdateManager(Addon): os.remove(filename) except OSError, e: - self.log_warning(_("Error removing: %s") % filename, e) + self.log_error(_("Error removing: %s") % filename, e) else: id = (type, name) -- cgit v1.2.3