Package: weboob
Version: 0.c-4
Severity: grave
Tags: patch upstream
Justification: renders package unusable

Hello,

Many commands of Weboob command line applications crash. For instance:

     traveloob> stations Arcueil
     Traceback (most recent call last):
       File "/usr/bin/traveloob", line 27, in <module>
         Traveloob.run()
       File 
"/usr/lib/python2.7/dist-packages/weboob/tools/application/console.py", line 
192, in run
         super(ConsoleApplication, klass).run(args)
       File 
"/usr/lib/python2.7/dist-packages/weboob/tools/application/base.py", line 392, 
in run
         sys.exit(app.main(args))
       File 
"/usr/lib/python2.7/dist-packages/weboob/tools/application/repl.py", line 281, 
in main
         self.cmdloop()
       File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop
         stop = self.onecmd(line)
       File 
"/usr/lib/python2.7/dist-packages/weboob/tools/application/repl.py", line 348, 
in onecmd
         self.flush()
       File 
"/usr/lib/python2.7/dist-packages/weboob/tools/application/repl.py", line 1078, 
in flush
         self.formatter.flush()
       File 
"/usr/lib/python2.7/dist-packages/weboob/tools/application/formatters/table.py",
 line 41, in flush
         s = self.get_formatted_table()
       File 
"/usr/lib/python2.7/dist-packages/weboob/tools/application/formatters/table.py",
 line 72, in get_formatted_table
         table.set_field_align(column_header, 'l')
       File "/usr/lib/pymodules/python2.7/prettytable.py", line 167, in 
__getattr__
         raise AttributeError(name)
     AttributeError: set_field_align

In fact, all the commands that are supposed to display a table are
failing this way. It seems related to the prettytable API change
reported on bug #673790 [1]. Although this may eventually be corrected
in prettytable, it would be faster and saner to fix it in Weboob too.

     [1] http://bugs.debian.org/673790

As this problem has already been fixed upstream [2] by working arount
the API change, fixing it in this package should be as simple as
temporarily integrating the attached patch as a local one in
debian/patches. And asking the release team to unblock your new version,
by reporting an unblock bug against the pseudo-package
relase.debian.org.

     [2] 
http://git.symlink.me/?p=romain/weboob-stable.git;a=commit;h=a8e2342edcbc38b940089822dafdcebd27b00946

Librement,

-- 
  ,--.
: /` )   Tanguy Ortolo      <xmpp:tan...@ortolo.eu>
| `-'    Debian Developer   <irc://irc.oftc.net/Tanguy>
  \_
>From a8e2342edcbc38b940089822dafdcebd27b00946 Mon Sep 17 00:00:00 2001
From: Florent <web...@flo.fourcot.fr>
Date: Mon, 21 May 2012 17:46:21 +0200
Subject: [PATCH] Fix table formatter with 0.6 version

I didn't see a way to only align header...
---
 weboob/tools/application/formatters/table.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/weboob/tools/application/formatters/table.py b/weboob/tools/application/formatters/table.py
index d11dc11..55e7468 100644
--- a/weboob/tools/application/formatters/table.py
+++ b/weboob/tools/application/formatters/table.py
@@ -69,7 +69,13 @@ class TableFormatter(IFormatter):
             s += "\n"
         table = PrettyTable(list(column_headers))
         for column_header in column_headers:
-            table.set_field_align(column_header, 'l')
+            # API changed in python-prettytable. The try/except is a bad hack to support both versions
+            # Note: two versions are not exactly the same... 
+            # (first one: header in center. Second one: left align for header too)
+            try:
+                table.set_field_align(column_header, 'l')
+            except:
+                table.align[column_header] = 'l'
         for line in queue:
             table.add_row(line)
 
-- 
1.7.2.5

Attachment: signature.asc
Description: Digital signature

Reply via email to