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

Change subject: Skip expandtemplates if the page content is empty
......................................................................


Skip expandtemplates if the page content is empty

Bug: 73529
Change-Id: If75d7fffab8b765699576e2954f5fb03c4af8ef2
---
M pywikibot/page.py
M pywikibot/site.py
2 files changed, 8 insertions(+), 0 deletions(-)

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



diff --git a/pywikibot/page.py b/pywikibot/page.py
index 68bfd5c..bda181f 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -493,6 +493,10 @@
         """
         if not hasattr(self, '_expanded_text') or (
                 self._expanded_text is None) or force:
+            if not self.text:
+                self._expanded_text = ''
+                return ''
+
             self._expanded_text = self.site.expand_text(
                 self.text,
                 title=self.title(withSection=False),
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 4a139fa..5b1399d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -1945,6 +1945,10 @@
         @return: unicode
 
         """
+        if not isinstance(text, basestring):
+            raise ValueError('text must be a string')
+        if not text:
+            return ''
         req = api.Request(site=self, action='expandtemplates', text=text)
         if title is not None:
             req['title'] = title

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If75d7fffab8b765699576e2954f5fb03c4af8ef2
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: XZise <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to