ia64/xen-unstable

changeset 8322:ffc9b7a09453

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@xensource.com>
author emellor@leeni.uk.xensource.com
date Mon Dec 12 16:32:19 2005 +0000 (2005-12-12)
parents 7ad6cf4260eb
children 566395e5a14f
files tools/python/xen/xend/sxp.py
line diff
     1.1 --- a/tools/python/xen/xend/sxp.py	Mon Dec 12 16:24:32 2005 +0000
     1.2 +++ b/tools/python/xen/xend/sxp.py	Mon Dec 12 16:32:19 2005 +0000
     1.3 @@ -696,13 +696,16 @@ def to_string(sxpr):
     1.4      io.close()
     1.5      return val
     1.6  
     1.7 -def from_string(str):
     1.8 +def from_string(s):
     1.9      """Create an sxpr by parsing a string.
    1.10  
    1.11 -    str string
    1.12 +    s string
    1.13      returns sxpr
    1.14      """
    1.15 -    io = StringIO(str)
    1.16 +    if s == '':
    1.17 +        return []
    1.18 +
    1.19 +    io = StringIO(s)
    1.20      vals = parse(io)
    1.21      if vals is []:
    1.22          return None
    1.23 @@ -710,13 +713,13 @@ def from_string(str):
    1.24          return vals[0]
    1.25      
    1.26  
    1.27 -def all_from_string(str):
    1.28 +def all_from_string(s):
    1.29      """Create an sxpr list by parsing a string.
    1.30  
    1.31 -    str string
    1.32 +    s string
    1.33      returns sxpr list
    1.34      """
    1.35 -    io = StringIO(str)
    1.36 +    io = StringIO(s)
    1.37      vals = parse(io)
    1.38      return vals
    1.39