Commits

Alexander Schremmer committed 44f3745

Finally fix pickling, remove game parameter to Player.__init__ again.

Comments (0)

Files changed (3)

domination/gameengine.py

 
 class Player(object):
     is_ai = False
-    def __init__(self, name, game):
+    def __init__(self, name):
         self.name = name
         self.discard_pile = []
         self.deck = []

domination/main.py

         for game, player in games.items():
             # XXX race condition possible
             if player.current:
-                game.kick(Player("Logout Button", game), player)
+                game.kick(Player("Logout Button"), player)
             else:
                 game.players.remove(player)
     return redirect(url_for("index"))
         if len(cards) != 10:
             return render_error(_("Must specify 10 card sets!"))
         game = DominationGame(name, cards)
-        player = Player(session["username"], game)
+        player = Player(session["username"])
         game.players.append(player)
         app.games[name] = GameRunner(game, player)
         get_store()["games"][game] = player
             except ValueError:
                 n = 1
             for i in range(n):
-                player = AIPlayer(names[i] + " [AI]", game)
+                player = AIPlayer(names[i] + " [AI]")
                 game.players.append(player)
         return redirect(url_for('game', name=name))
     def transform_sets(sets):
     assert not game_runner in get_store()["games"]
     if not game_runner.joinable:
         return render_error(_("Game has begun or ended already."))
-    get_store()["games"][game_runner.game] = player = Player(session["username"], game_runner.game)
+    get_store()["games"][game_runner.game] = player = Player(session["username"])
     game = game_runner.game
     assert player not in game.players
     game.players.append(player)

domination/tools.py

             return self % self.parameters
         return t.ugettext(self[:]) % self.parameters
 
-    def __newargs__(self):
-        return (self.pristine_str, self.parameters)
+    def __reduce__(self):
+        return (Translatable, (self.pristine_str, self.parameters))
 
 
 def _(string, parameters=()):