Blob Blame History Raw
diff -up pydot-1.0.3/pydot.py.BAD pydot-1.0.3/pydot.py
--- pydot-1.0.3/pydot.py.BAD	2010-11-03 11:02:36.572752008 -0400
+++ pydot-1.0.3/pydot.py	2010-11-03 11:04:29.832752009 -0400
@@ -153,28 +153,17 @@ def needs_quotes( s ):
     need quotes too.
     """
         
+    # All keywords must be quoted
     if s in dot_keywords:
-        return False
-
-    chars = [ord(c) for c in s if ord(c)>0x7f or ord(c)==0]
-    if chars and not id_re_dbl_quoted.match(s):
-        return True
-        
-    res = id_re_alpha_nums.match(s)
-    if not res:
-        res = id_re_num.match(s)
-        if not res:
-            res = id_re_dbl_quoted.match(s)
-            if not res:
-                res = id_re_html.match(s)
-                if not res:
-                    res = id_re_with_port.match(s)
-
-    if not res:
         return True
 
-    return False
+    # If any of these regexes match, then the string does not need quoting
+    if (id_re_alpha_nums.match(s) or id_re_num.match(s) or
+            id_re_dbl_quoted.match(s) or id_re_html.match(s) or
+            id_re_with_port.match(s)):
+        return False
 
+    return True
 
 
 def quote_if_necessary(s):