Revision: 4695 Author: rotem Date: 2007-12-11 14:06:56 +0000 (Tue, 11 Dec 2007)
Log Message: ----------- Making it possible to check multiple families in testfamily.py; dropping namespaces list, since namespaces are not currently updated in the family variables.
Modified Paths: -------------- trunk/pywikipedia/testfamily.py
Modified: trunk/pywikipedia/testfamily.py =================================================================== --- trunk/pywikipedia/testfamily.py 2007-12-11 13:57:21 UTC (rev 4694) +++ trunk/pywikipedia/testfamily.py 2007-12-11 14:06:56 UTC (rev 4695) @@ -39,39 +39,36 @@ def main(): all = False language = None + fam = None for arg in wikipedia.handleArgs(): if arg == '-all': all = True - elif arg[0:10] == '-language:': - language = arg[10:] + elif arg[0:7] == '-langs:': + language = arg[7:] + elif arg[0:10] == '-families:': + family = arg[10:]
mySite = wikipedia.getSite() if language is None: language = mySite.lang - fam = mySite.family + if fam is None: + fam = mySite.family.name
- if all: - for lang in fam.langs.iterkeys(): - testSite(wikipedia.getSite(lang)) - else: - languages = language.split(',') - for lang in languages: - testSite(wikipedia.getSite(lang)) + families = fam.split(',') + for family in families: + try: + fam = wikipedia.Family(family) + except ValueError: + wikipedia.output(u'No such family %s' % family) + continue + if all: + for lang in fam.langs.iterkeys(): + testSite(wikipedia.getSite(lang, family)) + else: + languages = language.split(',') + for lang in languages: + testSite(wikipedia.getSite(lang, family))
- if False: - # skip until the family gets global fixing - wikipedia.output(u"\n\n------------------ namespace table -------------------\n"); - - wikipedia.output(u" self.namespaces = {") - for k,v in sorted(fam.namespaces.iteritems()): - wikipedia.output(u" %i: {" % k) - for k2,v2 in sorted(v.iteritems()): - if v2 is not None: - v2 = u"u'%s'" % v2 - wikipedia.output(u" '%s': %s," % (k2,v2)) - wikipedia.output(u" },") - wikipedia.output(u" }") - if __name__ == "__main__": try: main()
pywikipedia-l@lists.wikimedia.org