Last modified: 2013-12-31 14:51:48 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57147, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55147 - templatesWithParams parser bug
templatesWithParams parser bug
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:32 UTC by Kunal Mehta (Legoktm)
Modified: 2013-12-31 14:51 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:32:27 UTC
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.
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:32:29 UTC
fixed in r11319, r11320
Comment 2 Kunal Mehta (Legoktm) 2013-10-05 04:32:31 UTC
- **assigned_to**: nobody --> xqt
- **status**: open --> closed-fixed
Comment 3 Kunal Mehta (Legoktm) 2013-10-05 04:32:33 UTC
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\_id=93107&atid=603138
Comment 4 Kunal Mehta (Legoktm) 2013-10-05 04:32:35 UTC
- **status**: closed-fixed --> open
Comment 5 Kunal Mehta (Legoktm) 2013-10-05 04:32:37 UTC
fixed in r11324. Would you please check the new commit.
Comment 6 Kunal Mehta (Legoktm) 2013-10-05 04:32:39 UTC
- **status**: open --> pending-fixed

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links