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

[Xen-changelog] Make from_string('') return []. This means that it is not necessary for our



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID ffc9b7a09453ce38917a18c3a1d5621d8747426b
# Parent  7ad6cf4260ebc614822fda159f7bcec47a0534e2
Make from_string('') return [].  This means that it is not necessary for our
callers to special-case this value -- the [] is a valid sxp.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 7ad6cf4260eb -r ffc9b7a09453 tools/python/xen/xend/sxp.py
--- a/tools/python/xen/xend/sxp.py      Mon Dec 12 16:24:32 2005
+++ b/tools/python/xen/xend/sxp.py      Mon Dec 12 16:32:19 2005
@@ -696,13 +696,16 @@
     io.close()
     return val
 
-def from_string(str):
+def from_string(s):
     """Create an sxpr by parsing a string.
 
-    str string
+    s string
     returns sxpr
     """
-    io = StringIO(str)
+    if s == '':
+        return []
+
+    io = StringIO(s)
     vals = parse(io)
     if vals is []:
         return None
@@ -710,13 +713,13 @@
         return vals[0]
     
 
-def all_from_string(str):
+def all_from_string(s):
     """Create an sxpr list by parsing a string.
 
-    str string
+    s string
     returns sxpr list
     """
-    io = StringIO(str)
+    io = StringIO(s)
     vals = parse(io)
     return vals
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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