def createTusers(self): global tusernum tdatabase.connect() tdatabase.cursor() content=tdatabase.curs.execute("SELECT * FROM Clients") myresult=content.fetchall() for row in myresult: tuserlist.append(Tuser(row[1],row[2])) tusernamedic[row[1]]=tuserlist[tusernum] tusernum+=1 tdatabase.commit() tdatabase.close_connection()
def createownclient(self,myusername,password): self.username=myusername global tusernum tdatabase.connect() tdatabase.cursor() count=0 for key in tusernamedic: if (key==myusername): count+=1 if (count==0): tuserlist.append(Tuser(myusername,password)) tusernamedic[myusername]=tuserlist[tusernum] tusernum+=1 tdatabase.curs.execute("INSERT INTO Clients(Username, Password)"" VALUES(?,?)", (myusername, password)) tdatabase.commit() tdatabase.close_connection()