Revision: 4211 Author: valhallasw Date: 2007-09-07 22:25:35 +0000 (Fri, 07 Sep 2007)
Log Message: ----------- * Removed old zh-classic hack * Added new zh-classic hack: if the zh-classic language is not found in the family file, fall back to 'zh-classical'.
Modified Paths: -------------- trunk/pywikipedia/families/wikipedia_family.py trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/families/wikipedia_family.py =================================================================== --- trunk/pywikipedia/families/wikipedia_family.py 2007-09-07 15:38:40 UTC (rev 4210) +++ trunk/pywikipedia/families/wikipedia_family.py 2007-09-07 22:25:35 UTC (rev 4211) @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*-
import urllib import family, config @@ -22,8 +22,6 @@ 'tokipona':'tokipona.wikipedia.org', 'zh-cn':'zh.wikipedia.org', 'zh-tw':'zh.wikipedia.org', - 'zh-classic': 'zh-classical.wikipedia.org' - # database thinks 'zh-classical' is 'zh-classic' as field type is varchar(10) } for lang in self.knownlanguages: if lang not in self.langs:
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2007-09-07 15:38:40 UTC (rev 4210) +++ trunk/pywikipedia/wikipedia.py 2007-09-07 22:25:35 UTC (rev 4211) @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- """ Library to get and put pages on a MediaWiki.
@@ -242,7 +242,7 @@ site = getSite() elif type(site) in [type(''), type(u'')]: site = getSite(site) - + self._site = site
if not insite: @@ -3144,8 +3144,13 @@ self.family = Family(fam, fatal = False) else: self.family = fam + if self.lang not in self.languages(): - raise KeyError("Language %s does not exist in family %s"%(self.lang,self.family.name)) + if self.lang == 'zh-classic' and 'zh-classical' in self.languages(): + self.lang = 'zh-classical' + # ev0l database hack (database is varchar[10] -> zh-classical is cut to zh-classic. + else: + raise KeyError("Language %s does not exist in family %s"%(self.lang,self.family.name))
# if we got an outdated language code, use the new one instead. if self.lang in self.family.obsolete and self.family.obsolete[self.lang]: @@ -4439,9 +4444,6 @@ return ['be','be-x-old','ru'] if code in ['kk','ky','tk']: return ['tr','ru'] - if code == 'zh-classic': - # the database uses 'zh-classic' instead of 'zh-classical' as the field is varchar(10) - return ['zh-classical','zh','zh-cn','zh-tw'] if code in ['diq','ug','uz']: return ['tr'] if code in ['ja','minnan','zh','zh-cn']: