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-changelog

[Xen-changelog] Use StringIO to simplify string_iterator here. Altered t

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Use StringIO to simplify string_iterator here. Altered the up-front
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Nov 2005 19:52:07 +0000
Delivery-date: Mon, 28 Nov 2005 19:52:29 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID d8786656ebabb03ae6076274aefc5f82c42e7cab
# Parent  d5368f7fda5d069f2b81c70da3a4626d123611d0
Use StringIO to simplify string_iterator here.  Altered the up-front
documentation.

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

diff -r d5368f7fda5d -r d8786656ebab tools/python/xen/util/bugtool.py
--- a/tools/python/xen/util/bugtool.py  Mon Nov 28 12:20:33 2005
+++ b/tools/python/xen/util/bugtool.py  Mon Nov 28 12:21:17 2005
@@ -22,6 +22,7 @@
 import re
 import os
 import os.path
+import StringIO
 import sys
 import tarfile
 import tempfile
@@ -53,12 +54,16 @@
     print '''
 This application will collate the Xen dmesg output, details of the hardware
 configuration of your machine, information about the build of Xen that you are
-using, plus, if you allow it, various logs.  These logs may contain private
-information, and if you are at all worried about that, you should exit now.
+using, plus, if you allow it, various logs.
 
 The information collated can either be posted to a Xen Bugzilla bug (this bug
 must already exist in the system, and you must be a registered user there), or
 it can be saved as a .tar.bz2 for sending or archiving.
+
+The collated logs may contain private information, and if you are at all
+worried about that, you should exit now, or you should explicitly exclude
+those logs from the archive.
+
 '''
     
     bugball = []
@@ -201,35 +206,13 @@
     return '\n'.join([format % i for i in d.items()]) + '\n'
 
 
-class string_iterator:
+class string_iterator(StringIO.StringIO):
     def __init__(self, name, val):
+        StringIO.StringIO.__init__(self, val)
         self.name = name
-        self.val = val
-        self.vallist = val.splitlines(True)
-        self.line = 0
-    
-    def readlines(self):
-        return self.vallist
-
-    def readline(self):
-        result = self.vallist[line]
-        line += 1
-        return result
-
-    def read(self, n = None):
-        if n is None:
-            return self.val
-        else:
-            return self.val[0:n]
-
-    def close(self):
-        pass
 
     def size(self):
-        return len(self.val)
-
-    def seek(self, _1, _2 = None):
-        pass
+        return len(self.getvalue())
 
 
 def yes(prompt):

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Use StringIO to simplify string_iterator here. Altered the up-front, Xen patchbot -unstable <=