def addPlayersAsIdentities(self): """Add all players with passwords as identities. """ for th in self.__ids.values(): if isinstance(th, player.Player) and hasattr(th, 'password'): styles.requireUpgrade(th) idname = th.name print "Adding identity %s" % idname ident = passport.Identity(idname, self.application) ident.setAlreadyHashedPassword(th.password) ident.addKeyForPerspective(th) try: self.application.authorizer.addIdentity(ident) except KeyError: print 'unable to add reality identity for %s' % idname
def upgradeToVersion1(self): from twisted.internet.app import theApplication styles.requireUpgrade(theApplication) pb.Service.__init__(self, 'twisted.words', theApplication)
def upgradeToVersion1(self): print 'Upgrading Twisted Reality instance.' from twisted.internet.app import theApplication styles.requireUpgrade(theApplication) pb.Service.__init__(self, 'twisted.reality', theApplication) self.addPlayersAsIdentities()