WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xend: fix SyntaxError for Python 2.4 or earlier
From: "KUWAMURA Shin'ya" <kuwa@xxxxxxxxxxxxxx>
Date: Thu, 29 Jul 2010 11:30:57 +0900 (JST)
Delivery-date: Wed, 28 Jul 2010 19:32:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xend: fix SyntaxError for Python 2.4 or earlier, KUWAMURA Shin'ya <=