示例#1
0
    def delete_glossary(self, url, username, apikey, lang = None):
        glossary = GlossaryService(url)

        try:
            glossary.delete(username, apikey, lang)
        except ZanataException, e:
            self.log.error(str(e))
    def delete_glossary(self, url, username, apikey, lang=None):
        glossary = GlossaryService(url)

        try:
            glossary.delete(username, apikey, lang)
        except ZanataException, e:
            self.log.error(str(e))
示例#3
0
    def csvglossary_push(self, path, url, username, apikey, locale_map, comments_header):
        csvconverter = CSVConverter()
        json = csvconverter.convert_to_json(path, locale_map, comments_header)
        glossary = GlossaryService(url)

        try:
            content = glossary.commit_glossary(username, apikey, json)
            if content:
                self.log.info("Successfully pushed glossary to the server")
        except ZanataException, e:
            self.log.error(str(e))
    def csvglossary_push(self, path, url, username, apikey, locale_map,
                         comments_header):
        csvconverter = CSVConverter()
        json = csvconverter.convert_to_json(path, locale_map, comments_header)
        glossary = GlossaryService(url)

        try:
            content = glossary.commit_glossary(username, apikey, json)
            if content:
                self.log.info("Successfully pushed glossary to the server")
        except ZanataException, e:
            self.log.error(str(e))
示例#5
0
    def csvglossary_push(self, path, url, username, apikey, locale_map, comments_header):
        csvconverter = CSVConverter()
        json = csvconverter.convert_to_json(path, locale_map, comments_header)        
        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)
示例#6
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)
示例#7
0
    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
    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