Esempio n. 1
0
    def poglossary_push(self, path, url, username, apikey, lang, sourcecomments):
        publicanutil = PublicanUtility()
        json = publicanutil.glossary_to_json(path, lang, sourcecomments)
        glossary = GlossaryService(url)

        try:
            content = glossary.commit_glossary(username, apikey, json)
            if content:
                self.log.info("Successfully pushed glossary to the server")
        except UnAvaliableResourceException:
            self.log.error("Can not push")
        except UnavailableServiceError:
            self.log.error("Service Temporarily Unavailable, stop processing!")
        except BadRequestBodyException, e:
            self.log.error(e.msg)
Esempio n. 2
0
    def poglossary_push(self, path, lang, sourcecomments):
        i = 0
        jsons = []
        publicanutil = PublicanUtility()
        jsons = publicanutil.glossary_to_json(path, lang, sourcecomments)
        size = len(jsons)
        if size > 1:
            self.log.warn("The file is big, try to divide it to small parts. It may take a long time to push!")

        while i < size:
            if size > 1:
                self.log.info("Push part %s of glossary file" % i)
            try:
                self.zanata_resource.glossary.commit_glossary(jsons[i])
            except ZanataException, e:
                self.log.error(str(e))
                sys.exit(1)
            i += 1
    def poglossary_push(self, path, url, username, apikey, lang,
                        sourcecomments):
        i = 0
        jsons = []
        publicanutil = PublicanUtility()
        jsons = publicanutil.glossary_to_json(path, lang, sourcecomments)
        glossary = GlossaryService(url)

        size = len(jsons)
        if size > 1:
            self.log.warn(
                "The file is big, try to devide it to small parts. It may take a long time to push!"
            )

        while i < size:
            if size > 1:
                self.log.info("Push part %s of glossary file" % i)
            try:
                glossary.commit_glossary(username, apikey, jsons[i])
            except ZanataException, e:
                self.log.error(str(e))
                sys.exit(1)

            i += 1