http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10401
Revision: 10401 Author: xqt Date: 2012-06-21 06:18:43 +0000 (Thu, 21 Jun 2012) Log Message: ----------- unicode is max 5 Bytes, so we can use a minimum amount
Modified Paths: -------------- trunk/pywikipedia/flickrripper.py
Modified: trunk/pywikipedia/flickrripper.py =================================================================== --- trunk/pywikipedia/flickrripper.py 2012-06-21 06:04:53 UTC (rev 10400) +++ trunk/pywikipedia/flickrripper.py 2012-06-21 06:18:43 UTC (rev 10401) @@ -161,7 +161,8 @@ descBytes = len(description.encode('utf-8')) if descBytes > maxBytes: # maybe we cut more than needed, anyway we do it - items = max(0, len(description) - descBytes + maxBytes) + items = max(min(len(description), maxBytes / 4), + len(description) - descBytes + maxBytes) description = description[:items] title = cleanUpTitle(description) else:
pywikipedia-svn@lists.wikimedia.org