jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/837203 )

Change subject: [bugfix]: Catch TypeError instead of AttributeError
......................................................................

[bugfix]: Catch TypeError instead of AttributeError

Catch the correct exception when match object is None.

Regression after I2e3e4073d317eb23b7ba040642e82edfbe471cdd

Bug: T319132
Change-Id: I02e8358ee4694f90dc0d1400fbca93e92829b4d5
---
M scripts/pagefromfile.py
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 4a564d5..8705099 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -217,7 +217,7 @@
         while text:
             try:
                 length, title, contents = self.findpage(text)
-            except AttributeError:
+            except TypeError:
                 if not length:
                     pywikibot.info('\nStart or end marker not found.')
                 else:
@@ -246,7 +246,7 @@
             + re.escape(self.opt.titleend))
         location = page_regex.search(text)
         if self.opt.include:
-            contents = location.group()
+            contents = location[0]
         else:
             contents = location[1]

@@ -257,7 +257,7 @@
                 if self.opt.notitle:
                     # Remove title (to allow creation of redirects)
                     contents = title_regex.sub('', contents, count=1)
-            except AttributeError:
+            except TypeError:
                 raise NoTitleError(location.end())

         return location.end(), title, contents

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/837203
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I02e8358ee4694f90dc0d1400fbca93e92829b4d5
Gerrit-Change-Number: 837203
Gerrit-PatchSet: 1
Gerrit-Owner: Mpaa <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to