pymensago/config.py
def load(path: str) -> RetVal:
	'''Attempts to load settings from the specified database.'''
	if not path:
		return RetVal(ErrEmptyData)
	
	global _modstate 

	try:
		conn = sqlite3.connect(path)
	except Exception as e:
		return RetVal().wrap_exception(e)

	_modstate['path'] = path
	_modstate['dbconn'] = conn
	
	# Ensure that the configuration table exists
	cur = conn.cursor()
	cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='appconfig';")
	exists = cur.fetchone()
	
	if not exists:
		cur.execute('''CREATE TABLE "appconfig" (
			"fname" TEXT NOT NULL UNIQUE,
			"ftype" TEXT NOT NULL,
			"fvalue" TEXT);''')
		conn.commit()

	return RetVal()
Attempts to load settings from the specified database.
Attempts to load settings from the specified database.
Attempts to load settings from the specified database .
def load(path: str) -> RetVal:
	if not path:
		return RetVal(ErrEmptyData)
	global _modstate 
	try:
		conn = sqlite3.connect(path)
	except Exception as e:
		return RetVal().wrap_exception(e)
	_modstate['path'] = path
	_modstate['dbconn'] = conn
	cur = conn.cursor()
	cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='appconfig';")
	exists = cur.fetchone()
	if not exists:
		cur.execute('''CREATE TABLE "appconfig" (
			"fname" TEXT NOT NULL UNIQUE,
			"ftype" TEXT NOT NULL,
			"fvalue" TEXT);''')
		conn.commit()
	return RetVal()
def load ( path : str ) -> RetVal : if not path : return RetVal ( ErrEmptyData ) global _modstate try : conn = sqlite3 . connect ( path ) except Exception as e : return RetVal ( ) . wrap_exception ( e ) _modstate [ 'path' ] = path _modstate [ 'dbconn' ] = conn cur = conn . cursor ( ) cur . execute ( "SELECT name FROM sqlite_master WHERE type='table' AND name='appconfig';" ) exists = cur . fetchone ( ) if not exists : cur . execute ( '''CREATE TABLE "appconfig" (
			"fname" TEXT NOT NULL UNIQUE,
			"ftype" TEXT NOT NULL,
			"fvalue" TEXT);''' ) conn . commit ( ) return RetVal ( )
Attempts to load settings from the specified database.
Attempts to load settings from the specified database .
'''Attempts to load settings from the specified database.''' # Ensure that the configuration table exists
path
str