Menu

#346 claimit.py: lang for source lookup

pending
Legoktm
None
5
2014-08-19
2013-08-31
APAC
No
def setSource(self, lang):

    page = pywikibot.Page(self.repo, 'Wikidata:List of wikis/python')
    source_values = json.loads(page.get())
    source_values = source_values['wikipedia']
    for lang in source_values:
        source_values[lang] = pywikibot.ItemPage(self.repo,
                                                 source_values[lang])

    if lang in source_values:
        self.source = pywikibot.Claim(self.repo, 'p143')
        self.source.setTarget(source_values.get(lang))

The use of lang in "for lang in source_values:" overwrites the lang in "def setSource(self, lang)". This leads to incorrect results. "lang" should be the language of the source wiki. For -cat:"zh:Category:Somevalue" this would be "zh".

Discussion

  • Legoktm

    Legoktm - 2013-08-31
     
  • Legoktm

    Legoktm - 2013-08-31
    • status: open --> pending
    • assigned_to: Legoktm
     
  • APAC

    APAC - 2013-09-01

    In the init part

    self.setSource(pywikibot.Site().language())
    

    might also need changing.

    Currently, if in the config file there is

    family = 'wikipedia'
    mylang = 'en'
    

    and claimit is called with

    -cat:zh:Category:Somevalue
    

    this leads to "en" to be used, instead of "zh".

     

Log in to post a comment.