[gnome-games] fix type check so gnome-sudoku works with pygobject >= 3.0.3



commit 8ab5a3a28281e6b1b649d9ef93628b3433ddd887
Author: John (J5) Palmieri <johnp redhat com>
Date:   Mon Jan 2 13:39:05 2012 -0500

    fix type check so gnome-sudoku works with pygobject >= 3.0.3
    
    gnome-sudoku was using if type(grid) == str to check if it needed
    to convert the game board to a list.  Unicode fixes in the latest
    pygobject returns unicode strings for any string stored in a
    TreeStore. The fix was to correctly check for any string using
    isinstance(grid, basestring)
    
    Note this will not work in python3 so needs to be looked at when
    porting

 gnome-sudoku/src/lib/sudoku.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/sudoku.py b/gnome-sudoku/src/lib/sudoku.py
index a345593..7d28608 100644
--- a/gnome-sudoku/src/lib/sudoku.py
+++ b/gnome-sudoku/src/lib/sudoku.py
@@ -130,7 +130,7 @@ class SudokuGrid(object):
         for n, col in enumerate([[(x, y) for y in range(self.group_size)] for x in range(self.group_size)]):
             self.col_coords[n] = col
         if grid:
-            if type(grid) == str:
+            if isinstance(grid, basestring):
                 g = re.split("\s+", grid)
                 side = int(math.sqrt(len(g)))
                 grid = []



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]