pymensago/workspace.py
def load_from_db(self, wid: UUID=None):
		'''Loads the workspace information from the local database. If no workspace ID is 
		specified, the identity workspace for the profile is loaded.'''
		
		if not wid or wid.is_empty():
			cursor = self.db.cursor()
			cursor.execute("SELECT wid FROM workspaces WHERE type = 'identity'")
			results = cursor.fetchone()
			if not results:
				return RetVal(ErrNotFound, 'No identity workspace found')
			wid = UUID(results[0])
		
		if not wid.is_valid():
			return RetVal(ErrBadData, 'Bad identity workspace in profile')
		
		cursor = self.db.cursor()
		cursor.execute("SELECT wid,domain,userid FROM workspaces WHERE wid = '?'",
			(wid.as_string(),))
		results = cursor.fetchone()
		if not results:
			return RetVal(ErrNotFound, 'Workspace data not found')
		
		status = self.wid.set(results[0])
		if status.error():
			return status.set_info(f"Bad workspace loaded from database: {results[0]}")
		status = self.domain.set(results[1])
		if status.error():
			return status.set_info(f"Bad domain loaded from database: {results[1]}")
		status = self.uid.set(results[2])
		if results[2] and status.error():
			return status.set_info(f"Bad user ID loaded from database: {results[2]}")
		
		return RetVal()
Loads the workspace information from the local database. If no workspace ID is 
		specified, the identity workspace for the profile is loaded.
Loads the workspace information from the local database. If no workspace ID is
specified, the identity workspace for the profile is loaded.
Loads the workspace information from the local database . If no workspace ID is specified the identity workspace for the profile is loaded .
def load_from_db(self, wid: UUID=None):
		if not wid or wid.is_empty():
			cursor = self.db.cursor()
			cursor.execute("SELECT wid FROM workspaces WHERE type = 'identity'")
			results = cursor.fetchone()
			if not results:
				return RetVal(ErrNotFound, 'No identity workspace found')
			wid = UUID(results[0])
		if not wid.is_valid():
			return RetVal(ErrBadData, 'Bad identity workspace in profile')
		cursor = self.db.cursor()
		cursor.execute("SELECT wid,domain,userid FROM workspaces WHERE wid = '?'",
			(wid.as_string(),))
		results = cursor.fetchone()
		if not results:
			return RetVal(ErrNotFound, 'Workspace data not found')
		status = self.wid.set(results[0])
		if status.error():
			return status.set_info(f"Bad workspace loaded from database: {results[0]}")
		status = self.domain.set(results[1])
		if status.error():
			return status.set_info(f"Bad domain loaded from database: {results[1]}")
		status = self.uid.set(results[2])
		if results[2] and status.error():
			return status.set_info(f"Bad user ID loaded from database: {results[2]}")
		return RetVal()
def load_from_db ( self , wid : UUID = None ) : if not wid or wid . is_empty ( ) : cursor = self . db . cursor ( ) cursor . execute ( "SELECT wid FROM workspaces WHERE type = 'identity'" ) results = cursor . fetchone ( ) if not results : return RetVal ( ErrNotFound , 'No identity workspace found' ) wid = UUID ( results [ 0 ] ) if not wid . is_valid ( ) : return RetVal ( ErrBadData , 'Bad identity workspace in profile' ) cursor = self . db . cursor ( ) cursor . execute ( "SELECT wid,domain,userid FROM workspaces WHERE wid = '?'" , ( wid . as_string ( ) , ) ) results = cursor . fetchone ( ) if not results : return RetVal ( ErrNotFound , 'Workspace data not found' ) status = self . wid . set ( results [ 0 ] ) if status . error ( ) : return status . set_info ( f"Bad workspace loaded from database: {results[0]}" ) status = self . domain . set ( results [ 1 ] ) if status . error ( ) : return status . set_info ( f"Bad domain loaded from database: {results[1]}" ) status = self . uid . set ( results [ 2 ] ) if results [ 2 ] and status . error ( ) : return status . set_info ( f"Bad user ID loaded from database: {results[2]}" ) return RetVal ( )
Loads the workspace information from the local database.
Loads the workspace information from the local database .
'''Loads the workspace information from the local database. If no workspace ID is 
		specified, the identity workspace for the profile is loaded.'''
self
wid
UUID