コード例 #1
0
ファイル: mwapidb.py プロジェクト: godiard/mwlib
 def getSource(self, title, revision=None):
     """Return source for given article title and revision. For this WikiDB,
     the paramaters are not used.
     
     @returns: source dict
     @rtype: dict
     """
     
     if self.source is not None:
         return self.source
     result = self.api_helper.query(meta='siteinfo')
     if result is None:
         return None
     try:
         g = result['general']
         self.source = metabook.make_source(
             url=g['base'],
             name='%s (%s)' % (g['sitename'], g['lang']),
             language=g['lang'],
         )
         self.getInterwikiMap(title, revision=revision)
         if self.interwikimap:
             self.source['interwikimap'] = self.interwikimap
         return self.source
     except KeyError:
         return None
コード例 #2
0
 def getSource(self, title, revision=None):
     """Return source for given article title and revision. For this WikiDB,
     the paramaters are not used.
     
     @returns: source dict
     @rtype: dict
     """
     
     if self.source is not None:
         return self.source
     result = self.api_helper.query(meta='siteinfo')
     if result is None:
         return None
     try:
         g = result['general']
         self.source = metabook.make_source(
             url=g['base'],
             name='%s (%s)' % (g['sitename'], g['lang']),
             language=g['lang'],
         )
         self.getInterwikiMap(title, revision=revision)
         if self.interwikimap:
             self.source['interwikimap'] = self.interwikimap
         return self.source
     except KeyError:
         return None
コード例 #3
0
ファイル: nuwiki.py プロジェクト: hexmode/mwlib
    def getSource(self, title, revision=None):
        from mwlib.metabook import make_source

        g = self.siteinfo["general"]
        return make_source(
            name="%s (%s)" % (g["sitename"], g["lang"]),
            url=g["base"],
            language=g["lang"],
            base_url=self.nfo["base_url"],
            script_extension=self.nfo["script_extension"],
        )
コード例 #4
0
    def getSource(self, title, revision=None):
        from mwlib.metabook import make_source

        g = self.siteinfo['general']
        return make_source(
            name='%s (%s)' % (g['sitename'], g['lang']),
            url=g['base'],
            language=g['lang'],
            base_url=self.nfo['base_url'],
            script_extension=self.nfo['script_extension'],
        )