jenkins-bot has submitted this change and it was merged.

Change subject: plugin: make search_entity fail if entity not found
......................................................................


plugin: make search_entity fail if entity not found

Change-Id: Ib3ee3d76d5420536b2a1853e55776d0566f32768
Signed-off-by: Loic Dachary <l...@dachary.org>
---
M FLOSSbot/plugin.py
1 file changed, 9 insertions(+), 6 deletions(-)

Approvals:
  Dachary: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/FLOSSbot/plugin.py b/FLOSSbot/plugin.py
index a4e04cf..5625675 100644
--- a/FLOSSbot/plugin.py
+++ b/FLOSSbot/plugin.py
@@ -211,12 +211,15 @@
             return super(Plugin, self).__getattribute__(name)
         label = " ".join(name.split('_')[1:])
         found = self.lookup_entity(label, type=type)
-        if not found and self.args.test:
-            self.create_entity(type, label)
-            for i in range(120):
-                found = self.lookup_entity(label, type=type)
-                if found is not None:
-                    break
+        if not found:
+            if self.args.test:
+                self.create_entity(type, label)
+                for i in range(120):
+                    found = self.lookup_entity(label, type=type)
+                    if found is not None:
+                        break
+            else:
+                raise ValueError("found no items for " + name)
         return found
 
     def get_source(self, claim, id):

-- 
To view, visit https://gerrit.wikimedia.org/r/316698
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3ee3d76d5420536b2a1853e55776d0566f32768
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary <l...@dachary.org>
Gerrit-Reviewer: Dachary <l...@dachary.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to