Ejemplo n.º 1
0
    def run(self):
        self.init_variables()

        self.licenses = get_licenses(self.metabook)

        api = self.get_api()
        self.fetch_collectionpage(api)
        self.fetch_pages_from_metabook(api)
Ejemplo n.º 2
0
    def run(self):
        self.init_variables()

        self.licenses = get_licenses(self.metabook)

        api = self.get_api()
        self.fetch_collectionpage(api)
        self.fetch_pages_from_metabook(api)
Ejemplo n.º 3
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
Ejemplo n.º 4
0
    def run(self):
        self.init_variables()
        
        self.licenses = get_licenses(self.metabook)
        podclient = self.podclient
        if podclient is not None:
            old_class = podclient.__class__
            podclient.__class__ = fetch.PODClient

        def login_failed(res):
            print "Fatal error: login failed:", res.getErrorMessage()
            return res

        def reset_podclient(val):
            if podclient is not None:
                podclient.__class__ = old_class
            return val
        
        return (self.get_api()
                .addErrback(login_failed)
                .addCallback(self.fetch_collectionpage)
                .addCallback(self.fetch_pages_from_metabook)
                .addBoth(reset_podclient))