gnome-games r7641 - in branches/gnome-2-22/glchess: . src/lib src/lib/chess



Author: rancell
Date: Sat May 10 06:01:38 2008
New Revision: 7641
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7641&view=rev

Log:
Handle unknown tokens (Bug #526252),  Correctly catch and display PGN errors

Modified:
   branches/gnome-2-22/glchess/ChangeLog
   branches/gnome-2-22/glchess/src/lib/chess/pgn.py
   branches/gnome-2-22/glchess/src/lib/main.py

Modified: branches/gnome-2-22/glchess/src/lib/chess/pgn.py
==============================================================================
--- branches/gnome-2-22/glchess/src/lib/chess/pgn.py	(original)
+++ branches/gnome-2-22/glchess/src/lib/chess/pgn.py	Sat May 10 06:01:38 2008
@@ -286,9 +286,12 @@
                     self.comment = ''
                     break
                 else:
-                    tokenType = self.tokens[text[0]]
+                    try:
+                        tokenType = self.tokens[text[0]]
+                    except KeyError:
+                        raise Error("Unknown token %s" % repr(text))
                     self.parseToken(tokenType, text)
-                    
+
             if self.comment is None:
                 return True
             

Modified: branches/gnome-2-22/glchess/src/lib/main.py
==============================================================================
--- branches/gnome-2-22/glchess/src/lib/main.py	(original)
+++ branches/gnome-2-22/glchess/src/lib/main.py	Sat May 10 06:01:38 2008
@@ -378,7 +378,7 @@
         try:
             p = chess.pgn.PGN(path, 1)
         except chess.pgn.Error, e:
-            return e.description
+            return e.message
         except IOError, e:
             return e.strerror
         



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