Ejemplo n.º 1
0
 def getLicenses(self):
     from mwlib import metabook
     licenses = self.nuwiki.get_data('licenses') or []
     res = []
     for x in licenses:
         if isinstance(x, dict):
             res.append(metabook.license(title=x["title"], wikitext=x["wikitext"], _wiki=self))
         elif isinstance(x, metabook.license):
             res.append(x)
             x._wiki = self
     return res
Ejemplo n.º 2
0
    def getLicenses(self):
        if self.licenses is None:
            # ZIP file of old mwlib version does not contain licenses...
            try:
                self.licenses = metabook.get_licenses(self.metabook)
            except Exception:
                self.licenses = []

                
        for i, x in enumerate(self.licenses):
            if isinstance(x, dict):
                x=self.licenses[i] = metabook.license(title=x.get("title"), wikitext=x.get("wikitext"))
                
            x._wiki = self
            
        return self.licenses