https://bugzilla.wikimedia.org/show_bug.cgi?id=72896

            Bug ID: 72896
           Summary: generate_family_file.py creates dodgy syntax for
                    semantic-mediawiki.org
           Product: Pywikibot
           Version: core (2.0)
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: Unprioritized
         Component: General
          Assignee: [email protected]
          Reporter: [email protected]
       Web browser: ---
   Mobile Platform: ---

The family file generator believes there is a language 'sw', but the writes a
family class with two 'en' langs, which is invalid dict syntax.

$ python ./generate_family_file.py https://www.semantic-mediawiki.org/wiki/
semantic-mw
Generating family file from https://www.semantic-mediawiki.org/wiki/

==================================
api url: https://semantic-mediawiki.org/w/api.php
MediaWiki version: 1.22.3
==================================

Determining other languages...sw

There are 2 languages available.
Do you want to generate interwiki links? This might take a long time.
([y]es/[N]o/[e]dit)y
Loading wikis... 
  * sw... downloaded
  * en... in cache
Writing pywikibot/families/semantic-mw_family.py... 


$ cat pywikibot/families/semantic-mw_family.py 
# -*- coding: utf-8 -*-
"""
This family file was auto-generated by $Id:
185033971c163ea46b2b1904773b8c407069a4d0 $
Configuration parameters:
  url = https://www.semantic-mediawiki.org/wiki/
  name = semantic-mw

Please do not commit this to the Git repository!
"""

from pywikibot import family

class Family(family.Family):
    def __init__(self):
        family.Family.__init__(self)
        self.name = 'semantic-mw'
        self.langs = {
            'en': 'semanticweb.org',
            'en': 'semantic-mediawiki.org',
        }



    def scriptpath(self, code):
        return {
            'en': '',
            'en': '/w',
        }[code]

    def version(self, code):
        return {
            'en': u'1.20.2',
            'en': u'1.22.3',
        }[code]


It isnt quite invalid syntax, but it is dodgy.
The family file 'works' because semantic-mediawiki.org is second in that list,
and all supported version of python return the second entry with the same key.

$ python2.6 pwb.py shell
Welcome to the Pywikibot interactive shell!
>>> import pywikibot
>>> s = pywikibot.Site('en', 'semantic-mw')
>>> s.family.langs
{'en': 'semantic-mediawiki.org'}
>>> {
...             'en': u'1.20.2',
...             'en': u'1.22.3',
...         }
{'en': u'1.22.3'}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to