Dalba has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376061 )

Change subject: api.QueryGenerator: Fix regression caused by 
64da531a33d13b9caccd561c64be9e
......................................................................

api.QueryGenerator: Fix regression caused by 64da531a33d13b9caccd561c64be9e

- QueryGenerator.set_namespace: Handle empty list of namespaces as well as
  None by returning early. Although handling them can also be done in the
  caller, but it's too easy for the programmer to forget about these special
  cases.
- Presence of _check_result_namespace is not enough for calling it;
 `self._namespaces` must be available, too. Use `_namespaces` as the condition
 instead.

Change-Id: Ie0d9bd027222786f969f7fa7660459b5fb810ea5
---
M pywikibot/data/api.py
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/61/376061/1

diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index c057b67..660b0b9 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -2677,6 +2677,9 @@
             type such as NoneType or bool, or more than one namespace
             if the API module does not support multiple namespaces
         """
+        if not namespaces and namespaces != 0:
+            return
+
         assert(self.limited_module)  # some modules do not have a prefix
         param = self.site._paraminfo.parameter('query+' + self.limited_module,
                                                'namespace')
@@ -2816,7 +2819,7 @@
                     self.normalized = {}
                 for item in resultdata:
                     result = self.result(item)
-                    if self._check_result_namespace is not NotImplemented:
+                    if self._namespaces:
                         if not self._check_result_namespace(result):
                             continue
                     yield result

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0d9bd027222786f969f7fa7660459b5fb810ea5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.w...@gmail.com>

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

Reply via email to