File: 673790.patch

package info (click to toggle)
python-cloudservers 1.1-1.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,724 kB
  • sloc: python: 2,004; makefile: 79
file content (31 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Description: update use of prettytable to the new API
Author: Sebastian Ramacher <sramacher@debian.org>
Last-Update: 2012-12-24

Index: python-cloudservers-1.1/cloudservers/shell.py
===================================================================
--- python-cloudservers-1.1.orig/cloudservers/shell.py	2012-12-24 14:46:12.069855412 +0100
+++ python-cloudservers-1.1/cloudservers/shell.py	2012-12-24 14:47:10.227633083 +0100
@@ -437,16 +437,18 @@
 # Helpers
 def print_list(objs, fields):
     pt = prettytable.PrettyTable([f for f in fields], caching=False)
-    pt.aligns = ['l' for f in fields]
+    for f in fields:
+      pt.align[f] = 'l'
     for o in objs:
         pt.add_row([getattr(o, f.lower().replace(' ', '_'), '') for f in fields])
-    pt.printt(sortby=fields[0])
+    print pt.get_string(sortby=fields[0])
     
 def print_dict(d):
     pt = prettytable.PrettyTable(['Property', 'Value'], caching=False)
-    pt.aligns = ['l', 'l']
+    pt.align['Property'] = 'l'
+    pt.align['Value'] = 'l'
     [pt.add_row(list(r)) for r in d.iteritems()]
-    pt.printt(sortby='Property')
+    print pt.get_string(sortby='Property')
 
 def main():
     try: