[Twisted-Python] Adding pb users online

Martin Stenhård stenis at stenhard.net
Wed Jan 14 17:29:42 EST 2004


Hi

I have the below code for my server with pb authentications. And that’s
works fine clients can login and do CallRemote. The clients can also login
as an anonymous users to add them self to users database that are stored in
a MySQL table. My question is how do I reload my users using registerChecker
with out stopping the server? So that the current online users don't lose
there connections.

c = checkers.InMemoryUsernamePasswordDatabaseDontUse()
# users comes from a SQL db
for user in users: 
        
       print "User  Password  Email Status  Disable Lastlogin"
       print user.username," ",user.password," ",user.email,"
",user.status," ",user.disable," ",
       print time.ctime(user.lastlogin)        
       c.addUser(user.username,user.password)
realm =MyRealm()
realm.server = GameServer()
p = portal.Portal(realm)    
p.registerChecker(c)
reactor.listenTCP(8800, pb.PBServerFactory(p))
reactor.run

/Martin





More information about the Twisted-Python mailing list