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

[Xen-devel] [PATCH] xend: fix SyntaxError for Python 2.4 or earlier



Hi,

21866:e017930af272 causes SyntaxError on Python 2.4 or earlier, since
the syntax "true_value if condition else false_value" was introduced
by Python 2.5.

Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
-- 
  KUWAMURA Shin'ya
# HG changeset patch
# User KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
# Date 1280369174 -32400
# Node ID ee0a8866f25a6293bf48f20975fd3f3ab39d0006
# Parent  41a598e585274a78fc8b129c25a4d16647aab97b
xend: fix SyntaxError for Python 2.4 or earlier

The syntax "true_value if condition else false_value" was introduced by
Python 2.5.

Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>

diff -r 41a598e58527 -r ee0a8866f25a tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Jul 29 10:41:15 2010 +0900
+++ b/tools/python/xen/xend/XendConfig.py       Thu Jul 29 11:06:14 2010 +0900
@@ -65,8 +65,10 @@ def bool0(v):
 
 def convert_on_crash(v):
     v = str(v)
-    return XEN_API_ON_CRASH_BEHAVIOUR_LEGACY[v] \
-            if v in XEN_API_ON_CRASH_BEHAVIOUR else v
+    if v in XEN_API_ON_CRASH_BEHAVIOUR:
+        return XEN_API_ON_CRASH_BEHAVIOUR_LEGACY[v]
+    else:
+        return v
 
 # Recursively copy a data struct, scrubbing out VNC passwords.
 # Will scrub any dict entry with a key of 'vncpasswd' or any
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.