def get_git_credentials(self):
        git_username = None
        encrypted_password = None

        if not os.name == 'nt':
            # Python 2
            # git_username = raw_input('Username: '******'Username: '******'None', 'none', 'N', 'n', '--none']:
                git_username = ""
                # log_info = "Git username disabled"
            else:
                log_info = 'Git username set to ' + git_username
            # self.update_config_file('git_username', git_username, self.conf_parser, self.config_file_name, log_info)
            if git_password in ['None', 'none', 'N', 'n', '--none']:
                git_password = ""
                # log_info = "Git password disabled"
            else:
                log_info = 'Git password set'
            # self.update_config_file('git_password', self.git_auto.encrypt(git_password), self.conf_parser, self.config_file_name, log_info)
        # else:
        #     error("Only SSH Key access is enabled on Windows")
        #     git_username = ""
        #     git_password = ""

        if not encrypted_password == None:
            git_auto = Git_Auto(self.path)
            encrypted_password = git_auto.encrypt(git_password)

        return git_username, encrypted_password
Exemple #2
0
 def __init__(self, path, watch=False, timeout=60):
     self.host = ''
     self.access_token = ''
     self.project_id = ''
     self.project_name = ''
     self.path = path
     self.community_id = ''
     self.workflow_id = ''  # default workflow id; MT phase only
     self.locale = ''
     self.clone_option = 'on'
     self.finalized_file = 'off'
     self.unzip_file = 'on'
     self.auto_format_option = ''
     self.download_option = 'clone'
     self.download_dir = None  # directory where downloaded translation will be stored
     self.watch_locales = set()  # if specified, add these target locales to any files in the watch folder
     self.git_autocommit = None
     self.git_username = ''
     self.git_password = ''
     self.append_option = 'none'
     self.locale_folders = {}
     self.default_metadata = {}
     self.metadata_prompt = False
     self.metadata_fields = METADATA_FIELDS
     if not self._is_initialized():
         raise exceptions.UninitializedError("This project is not initialized. Please run init command.")
     self._initialize_self()
     self.watch = watch
     self.doc_manager = DocumentManager(self.path)
     self.folder_manager = FolderManager(self.path)
     self.timeout = timeout
     self.api = ApiCalls(self.host, self.access_token, self.watch, self.timeout)
     self.git_auto = Git_Auto(self.path)
     self.error_file_name = os.path.join(self.path, CONF_DIR, ERROR_FN)
Exemple #3
0
 def __init__(self, path=None, timeout=60):
     Action.__init__(self, path, True, timeout)
     self.observers = []  # watchdog observers that will watch the files
     self.handler = WatchHandler()
     self.handler.on_modified = self._on_modified
     self.handler.on_created = self._on_created
     self.handler.on_moved = self._on_moved
     self.watch_queue = [
     ]  # not much slower than deque unless expecting 100+ items
     self.locale_delimiter = None
     self.ignore_ext = []  # file types to ignore as specified by the user
     self.detected_locales = {}  # dict to keep track of detected locales
     self.watch_folder = True
     self.timeout = timeout
     self.updated = {}
     self.git_auto = Git_Auto(path)
     self.polled_list = set([])
     self.force_poll = False
     self.add = add_action.AddAction(path)
     self.download = download_action.DownloadAction(path)
     self.root_path = path
     self.download_file_paths = set()  # set of download file path names
Exemple #4
0
 def __init__(self, path, download):
     Action.__init__(self, path)
     self.git_auto = Git_Auto(path)
     self.download = download