Esempio n. 1
0
    def push_command(self, file_list, srcfolder, project_id, iteration_id, copytrans, plural_support = False, import_param = None):
        """
        Push the content of publican files to a Project version on Zanata server
        @param args: name of the publican file
        """
        publicanutil = PublicanUtility()

        for filepath in file_list:
            self.log.info("\nPushing the content of %s to server:"%filepath)
            plural_exist = publicanutil.check_plural(filepath)
            if plural_exist and not plural_support:
                self.log.error("The plural is only supported in zanata server >= 1.6, this file will be ignored")
                break
            body, filename = publicanutil.potfile_to_json(filepath, srcfolder)

            try:
                result = self.update_template(project_id, iteration_id, filename, body, copytrans)
                if result:
                    self.log.info("Successfully pushed %s to the server"%filepath)
            except UnAuthorizedException, e:
                self.log.error(str(e))
                break
            except BadRequestBodyException, e:
                self.log.error(str(e))
                continue
    def push_command(self,
                     file_list,
                     srcfolder,
                     project_id,
                     iteration_id,
                     copytrans,
                     plural_support=False,
                     import_param=None):
        """
        Push the content of publican files to a Project version on Zanata server
        @param args: name of the publican file
        """
        publicanutil = PublicanUtility()

        for filepath in file_list:
            self.log.info("\nPushing the content of %s to server:" % filepath)
            plural_exist = publicanutil.check_plural(filepath)
            if plural_exist and not plural_support:
                self.log.error(
                    "The plural is only supported in zanata server >= 1.6, this file will be ignored"
                )
                break
            body, filename = publicanutil.potfile_to_json(filepath, srcfolder)
            try:
                result = self.update_template(project_id, iteration_id,
                                              filename, body, copytrans)
                if result:
                    self.log.info("Successfully pushed %s to the server" %
                                  filepath)
            except UnAuthorizedException, e:
                self.log.error(str(e))
                break
            except BadRequestBodyException, e:
                self.log.error(str(e))
                continue