def load( self ): print "Loading..." mongo_object = self.games_database().find_one({u'_id': ObjectId(self.mongo_id)} ) self.width = int(mongo_object[u'width']) self.height = int(mongo_object[u'height']) self.grid = Grid( self.width, self.height ) self.tokens = [ tokens.deserialize( token ) for token in mongo_object[u'tokens'] ] self.currentToken = tokens.deserialize( mongo_object[u'currentToken'] ) self.gametype = mongo_object[u'gametype'] self.gamestate = mongo_object[u'gamestate'] self.mongo_id = mongo_object[u'_id'] self.failureCounter = mongo_object[u'failureCounter'] self.lastBomb = mongo_object[u'lastBomb'] self.lastJoker = mongo_object[u'lastJoker'] self.scramble = mongo_object[u'scramble'] self.grid.unserialize( mongo_object[u'grid'] ) print "Load complete."
def unserialize_move( move ): movecounter, movename, token, point = move return ( movecounter, movename, tokens.deserialize( token ), point )