How to use the ltk.utils.error function in ltk

To help you get started, we’ve selected a few ltk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Lingotek / filesystem-connector / python2 / ltk / git_auto.py View on Github external
def repo_exists(self, repo_directory=os.getcwd()):
		while repo_directory and repo_directory != "" and not (os.path.isdir(repo_directory + "/.git")):
			repo_directory = repo_directory.split(os.sep)[:-1]
			repo_directory = (os.sep).join(repo_directory)
		if not repo_directory or repo_directory == "":
			error("No Git repository found for the current directory.")
			return False
		else:
			self.repo_directory = repo_directory
			self.initialize_repo()
			return True
github Lingotek / filesystem-connector / python3 / ltk / git_auto.py View on Github external
def repo_exists(self, repo_directory=os.getcwd()):
		while repo_directory and repo_directory != "" and not (os.path.isdir(repo_directory + os.sep+".git")):
			repo_directory = repo_directory.split(os.sep)[:-1]
			repo_directory = (os.sep).join(repo_directory)
		if not repo_directory or repo_directory == "":
			error("No Git repository found for the current directory.")
			return False
		else:
			self.repo_directory = repo_directory
			self.initialize_repo()
			return True
github Lingotek / filesystem-connector / python3 / ltk / git_auto.py View on Github external
def repo_exists(self, repo_directory=os.getcwd()):
		while repo_directory and repo_directory != "" and not (os.path.isdir(repo_directory + "/.git")):
			repo_directory = repo_directory.split(os.sep)[:-1]
			repo_directory = (os.sep).join(repo_directory)
		if not repo_directory or repo_directory == "":
			error("No Git repository found for the current directory.")
			return False
		else:
			self.repo_directory = repo_directory
			self.initialize_repo()
			return True
github Lingotek / filesystem-connector / python3 / ltk / git_auto.py View on Github external
def push(self, username=None, password=None):
		username = self.conf_parser.get('main', 'git_username')
		password = self.conf_parser.get('main', 'git_password')
		if not self.repo_is_defined:
			if not (self.repo_exists()):
				error("No Git repository found for the current directory.")
				return
		try:
			g = pexpect.spawnu('git push')
		except:
			try:
				self.repo.git.push()
				print("Push was successful")
			except Exception as e:
				error("Git push failed!")
				print(type(e))
			return
		try:
			g.logfile_read = sys.stdout
			while True:
				i = g.expect([u'Username for .*', u'Password for .*', pexpect.EOF])
				if(i == 0):
					g.send(username+'\n')
				elif(i == 1):
					# Python 2
					# g.send(codecs.decode(password, 'base64')+'\n')
					# End Python 2
					# Python 3
					g.send(str(codecs.decode(password.encode(), 'base64'), 'utf-8')+'\n')
					# End Python 3
				else: