From ae09f609c2bd7f1066d4d89a17bbae161d2ab74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 24 Feb 2015 07:37:51 +0100 Subject: [PATCH] Improved message when no plugins are found --- senpy/extensions.py | 10 +++++----- setup.py | 2 +- tests/extensions_test/__init__.py | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/senpy/extensions.py b/senpy/extensions.py index 03bc554..4d903a6 100644 --- a/senpy/extensions.py +++ b/senpy/extensions.py @@ -68,10 +68,10 @@ class Senpy(object): algo = params["algorithm"] elif self.plugins: algo = self.default_plugin and self.default_plugin.name - if not algo: - return Error(status=404, - message=("No plugins found." - " Please install one.").format(algo)) + if not algo: + return Error(status=404, + message=("No plugins found." + " Please install one.").format(algo)) if algo in self.plugins: if self.plugins[algo].is_activated: plug = self.plugins[algo] @@ -88,7 +88,7 @@ class Senpy(object): logger.debug(("The algorithm '{}' is not valid\n" "Valid algorithms: {}").format(algo, self.plugins.keys())) - return Error(status=400, + return Error(status=404, message="The algorithm '{}' is not valid" .format(algo)) diff --git a/setup.py b/setup.py index 9bd8553..f3f8fab 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ install_reqs = parse_requirements("requirements.txt") # e.g. ['django==1.5.1', 'mezzanine==1.4.6'] reqs = [str(ir.req) for ir in install_reqs] -VERSION = "0.4.0" +VERSION = "0.4.1" print(reqs) diff --git a/tests/extensions_test/__init__.py b/tests/extensions_test/__init__.py index de1f407..0cbbee6 100644 --- a/tests/extensions_test/__init__.py +++ b/tests/extensions_test/__init__.py @@ -75,6 +75,7 @@ class ExtensionsTest(TestCase): resp = self.senpy.analyse(input="tupni") logging.debug("Response: {}".format(resp)) assert resp["status"] == 404 + def test_filtering(self): """ Filtering plugins """