http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9208
Revision: 9208 Author: xqt Date: 2011-05-02 03:31:55 +0000 (Mon, 02 May 2011) Log Message: ----------- enable int type for ListToParam, bugfix for bug #3295288 introduced by r9196
Modified Paths: -------------- trunk/pywikipedia/query.py
Modified: trunk/pywikipedia/query.py =================================================================== --- trunk/pywikipedia/query.py 2011-05-01 21:05:06 UTC (rev 9207) +++ trunk/pywikipedia/query.py 2011-05-02 03:31:55 UTC (rev 9208) @@ -264,18 +264,21 @@ encList = '' # items may not have one symbol - '|' for item in list: - if isinstance(item,basestring): + if isinstance(item, basestring): if u'|' in item: - raise wikipedia.Error(u"item '%s' contains '|' symbol" % item ) + raise wikipedia.Error(u"item '%s' contains '|' symbol" % item) encList += ToUtf8(item) + u'|' - elif isinstance(item,wikipedia.Page): + if type(item) == 'int': + encList += ToUtf8(item) + u'|' + elif isinstance(item, wikipedia.Page): encList += ToUtf8(item.title()) + u'|' elif item.__class__.__name__ == 'User': # delay loading this until it is needed import userlib encList += ToUtf8(item.name()) + u'|' else: - raise wikipedia.Error(u'unknown item class %s' % item.__class__.__name__) + raise wikipedia.Error(u'unknown item class %s' + % item.__class__.__name__)
# strip trailing '|' before returning return encList[:-1]