pymensago/workspace.py
def add_to_db(self, pw: encryption.Password) -> RetVal:
		'''Adds a workspace to the storage database'''

		cursor = self.db.cursor()
		cursor.execute("SELECT wid FROM workspaces WHERE type = 'identity'")
		results = cursor.fetchone()
		if results:
			return RetVal(ErrExists, self.wid.as_string())
		
		if self.uid.is_valid():
			cursor.execute('''INSERT INTO workspaces(wid,userid,domain,password,pwhashtype,type)
				VALUES(?,?,?,?,?,?)''', 
				(self.wid.as_string(), self.uid.as_string(), self.domain.as_string(), 
					pw.hashstring, pw.hashtype, self.type))
		else:
			cursor.execute('''INSERT INTO workspaces(wid,domain,password,pwhashtype,type)
				VALUES(?,?,?,?,?)''', 
				(self.wid.as_string(), self.domain.as_string(), pw.hashstring, pw.hashtype, 
					self.type))
		self.db.commit()
		return RetVal()
Adds a workspace to the storage database
Adds a workspace to the storage database
Adds a workspace to the storage database
def add_to_db(self, pw: encryption.Password) -> RetVal:
		cursor = self.db.cursor()
		cursor.execute("SELECT wid FROM workspaces WHERE type = 'identity'")
		results = cursor.fetchone()
		if results:
			return RetVal(ErrExists, self.wid.as_string())
		if self.uid.is_valid():
			cursor.execute('''INSERT INTO workspaces(wid,userid,domain,password,pwhashtype,type)
				VALUES(?,?,?,?,?,?)''', 
				(self.wid.as_string(), self.uid.as_string(), self.domain.as_string(), 
					pw.hashstring, pw.hashtype, self.type))
		else:
			cursor.execute('''INSERT INTO workspaces(wid,domain,password,pwhashtype,type)
				VALUES(?,?,?,?,?)''', 
				(self.wid.as_string(), self.domain.as_string(), pw.hashstring, pw.hashtype, 
					self.type))
		self.db.commit()
		return RetVal()
def add_to_db ( self , pw : encryption . Password ) -> RetVal : cursor = self . db . cursor ( ) cursor . execute ( "SELECT wid FROM workspaces WHERE type = 'identity'" ) results = cursor . fetchone ( ) if results : return RetVal ( ErrExists , self . wid . as_string ( ) ) if self . uid . is_valid ( ) : cursor . execute ( '''INSERT INTO workspaces(wid,userid,domain,password,pwhashtype,type)
				VALUES(?,?,?,?,?,?)''' , ( self . wid . as_string ( ) , self . uid . as_string ( ) , self . domain . as_string ( ) , pw . hashstring , pw . hashtype , self . type ) ) else : cursor . execute ( '''INSERT INTO workspaces(wid,domain,password,pwhashtype,type)
				VALUES(?,?,?,?,?)''' , ( self . wid . as_string ( ) , self . domain . as_string ( ) , pw . hashstring , pw . hashtype , self . type ) ) self . db . commit ( ) return RetVal ( )
Adds a workspace to the storage database
Adds a workspace to the storage database
'''Adds a workspace to the storage database'''
self
pw
encryption.Password