Beispiel #1
0
	def writeChanges(self):
		if self.connFile == self.newFileName:
			# Ask for a file name
			pth = dui.getSaveAs(message=_("Save File As..."),
					wildcard=self.fileExtension)
			if pth is None:
				return
			else:
				pthName = os.path.basename(pth)
				if not pthName.split(".")[-1] == self.fileExtension:
					# Add the extension
					if pth[-1] != ".":
						pth += "."
					pth += self.fileExtension
				self.connFile = pth
		# Create the file so that the relative pathing works correctly
		file(self.connFile, "w")
		# Get the values from the connDict, and adjust any pathing
		# to be relative
		vals = self.relPaths(list(self.connDict.values()))
		v0 = vals[0]
		if self.isFileBasedBackend(v0["dbtype"]):
			# Previous values from the form might still be in the dict.
			# Blank them out, as they are not valid for file-based backends.
			v0["host"] = v0["user"] = v0["password"] = v0["port"] = ""
		xml = createXML(vals, encoding="utf-8")
		file(self.connFile, "w").write(xml)
		dabo.ui.callAfter(self.bringToFront)
Beispiel #2
0
	def writeChanges(self):
		if self.connFile == self.newFileName:
			# Ask for a file name
			pth = dui.getSaveAs(message=_("Save File As..."),
					wildcard=self.fileExtension)
			if pth is None:
				return
			else:
				pthName = os.path.basename(pth)
				if not pthName.split(".")[-1] == self.fileExtension:
					# Add the extension
					if pth[-1] != ".":
						pth += "."
					pth += self.fileExtension
				self.connFile = pth
		# Create the file so that the relative pathing works correctly
		file(self.connFile, "w")
		# Get the values from the connDict, and adjust any pathing
		# to be relative
		vals = self.relPaths(self.connDict.values())
		v0 = vals[0]
		if self.isFileBasedBackend(v0["dbtype"]):
			# Previous values from the form might still be in the dict.
			# Blank them out, as they are not valid for file-based backends.
			v0["host"] = v0["user"] = v0["password"] = v0["port"] = ""
		xml = createXML(vals, encoding="utf-8")
		file(self.connFile, "w").write(xml)
		dabo.ui.callAfter(self.bringToFront)
Beispiel #3
0
 def getDbConnXML(self, ci):
     cxnDict = {
         "dbtype": ci.DbType,
         "host": ci.Host,
         "database": ci.Database,
         "user": ci.User,
         "password": ci.Password,
         "port": ci.Port,
         "name": ci.Name
     }
     return createXML(cxnDict, encoding="utf-8")
Beispiel #4
0
	def getDbConnXML(self, ci):
		cxnDict = {"dbtype" : ci.DbType, "host" : ci.Host,
				"database" : ci.Database, "user" : ci.User,
				"password" : ci.Password, "port" : ci.Port,
				"name" : ci.Name}
		return createXML(cxnDict, encoding="utf-8")