[CalendarServer-changes] [9040] CalendarServer/trunk/calendarserver/tools/tables.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 12 10:59:37 PDT 2012


Revision: 9040
          http://trac.macosforge.org/projects/calendarserver/changeset/9040
Author:   wsanchez at apple.com
Date:     2012-04-12 10:59:37 -0700 (Thu, 12 Apr 2012)
Log Message:
-----------
Define __all__.
Add toString()

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/tables.py

Modified: CalendarServer/trunk/calendarserver/tools/tables.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/tables.py	2012-04-12 16:57:54 UTC (rev 9039)
+++ CalendarServer/trunk/calendarserver/tools/tables.py	2012-04-12 17:59:37 UTC (rev 9040)
@@ -14,9 +14,20 @@
 # limitations under the License.
 ##
 
+"""
+Tables for fixed-width text display.
+"""
+
+__all__ = [
+    "Table",
+]
+
+
 from sys import stdout
 import types
+from cStringIO import StringIO
 
+
 class Table(object):
     """
     Class that allows pretty printing ascii tables.
@@ -109,6 +120,12 @@
         
         self.rows.append((None, skipColumns,))
 
+    def toString(self):
+
+        output = StringIO()
+        self.printTable(os=output)
+        return output.getvalue()
+
     def printTable(self, os=stdout):
         
         maxWidths = self._getMaxWidths()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120412/ba33715d/attachment.html>


More information about the calendarserver-changes mailing list