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

[Xen-changelog] Added behaviour to read() to read directly from the transaction's path if no



# HG changeset patch
# User emellor@ewan
# Node ID a65cdee92c0f5ce1c8240710b258013f9827002e
# Parent  1e288a9316fdff2967889ae9ac5d016fa4e996d2
Added behaviour to read() to read directly from the transaction's path if no
arguments are specified.

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

diff -r 1e288a9316fd -r a65cdee92c0f 
tools/python/xen/xend/xenstore/xstransact.py
--- a/tools/python/xen/xend/xenstore/xstransact.py      Wed Sep 28 12:41:44 2005
+++ b/tools/python/xen/xend/xenstore/xstransact.py      Wed Sep 28 12:43:07 2005
@@ -42,8 +42,15 @@
                                '%s, while reading %s' % (ex.args[1], path))
 
     def read(self, *args):
-        if len(args) == 0:
-            raise TypeError
+        """If no arguments are given, return the value at this transaction's
+        path.  If one argument is given, treat that argument as a subpath to
+        this transaction's path, and return the value at that path.
+        Otherwise, treat each argument as a subpath to this transaction's
+        path, and return a list composed of the values at each of those
+        instead.
+        """
+        if len(args) == 0:
+            return xshandle().read(self.path)
         if len(args) == 1:
             return self._read(args[0])
         ret = []
@@ -191,6 +198,13 @@
 
 
     def Read(cls, path, *args):
+        """If only one argument is given (path), return the value stored at
+        that path.  If two arguments are given, treat the second argument as a
+        subpath within the first, and return the value at the composed path.
+        Otherwise, treat each argument after the first as a subpath to the
+        given path, and return a list composed of the values at each of those
+        instead.  This operation is performed inside a transaction.
+        """
         while True:
             t = cls(path)
             try:
@@ -234,6 +248,12 @@
     Remove = classmethod(Remove)
 
     def List(cls, path, *args):
+        """If no arguments are given (path), list its contents, returning the
+        entries therein, or None if no entries are found.  Otherwise, treat
+        each further argument as a subpath to the given path, and return the
+        cumulative listing of each of those instead.  This operation is
+        performed inside a transaction.
+        """
         while True:
             t = cls(path)
             try:

_______________________________________________
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®.