https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
Web browser: --- Bug ID: 55147 Summary: templatesWithParams parser bug Product: Pywikibot Version: unspecified Hardware: All OS: All Status: ASSIGNED Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: legoktm.wikipedia@gmail.com Classification: Unclassified Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1605/ Reported by: leeyc0 Created on: 2013-04-01 11:37:55 Subject: templatesWithParams parser bug Assigned to: xqt Original description: version.py info: Pywikipedia [http] trunk/pywikipedia (r11308, 2013/03/30, 16:56:02, OUTDATED) Python 2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2] config-settings: use_api = True use_api_login = True unicode test: ok
Below is the code snippet that demonstrates the bug:
#!/usr/bin/python # -*- coding: utf-8 -*- import wikipedia as pywikibot site = pywikibot.getSite() page = pywikibot.Page(site, "Template:001") # or some other page, the page itself is irrelevant here pageText = u"{{monster | {{{1}}} | id=001}}" print(page.templatesWithParams(pageText))
I found that the output is [(u'1', [])]
instead of expected value [(u'Monster', [u' {{{1}}}', u' id=001'])]
However, if I change pageText to
pageText = u"{{monster | abc | id=001}}"
Then the output would be [(u'Monster', [u' abc ', u' id=001'])]
Which is correct.
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
--- Comment #1 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- fixed in r11319, r11320
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
--- Comment #2 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- - **assigned_to**: nobody --> xqt - **status**: open --> closed-fixed
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
--- Comment #3 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- reopened due to bug #3609794
I only chanced textlib.extract_templates_and_params() which worked good for me. But Page.templatesWithParams() still fails
https://sourceforge.net/tracker/?func=detail&aid=3609794&group%5C_id...
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
--- Comment #4 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- - **status**: closed-fixed --> open
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
--- Comment #5 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- fixed in r11324. Would you please check the new commit.
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
--- Comment #6 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- - **status**: open --> pending-fixed
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://sourceforge.net/p/p | |ywikipediabot/bugs/1605
https://bugzilla.wikimedia.org/show_bug.cgi?id=55147
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |info@gno.de Resolution|--- |FIXED
pywikipedia-bugs@lists.wikimedia.org