[Mpuls-commits] r5957 - base/trunk/mpulsweb/lib

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu May 10 09:57:16 CEST 2012


Author: bricks
Date: 2012-05-10 09:57:16 +0200 (Thu, 10 May 2012)
New Revision: 5957

Modified:
   base/trunk/mpulsweb/lib/export.py
Log:
Raise a warning if table title is not set

Don't assume that the application never passes an empty table title to the XLS exports.
Instead raise a warning if a table title is not set and set the table title to the table
name. Never never never expect a specific behaviour of your software when not proving
if it's behaving this way.


Modified: base/trunk/mpulsweb/lib/export.py
===================================================================
--- base/trunk/mpulsweb/lib/export.py	2012-05-07 14:14:48 UTC (rev 5956)
+++ base/trunk/mpulsweb/lib/export.py	2012-05-10 07:57:16 UTC (rev 5957)
@@ -129,6 +129,10 @@
                 if table_name not in table_columns:
                     table_order.append(table_name)
                 table_columns.setdefault(table_name, []).append(nc.getName())
+                if not table_title:
+                    log.warning("Table title for table %s is empty. Using " \
+                                " table name as title." % table_name)
+                    table_title = table_name
                 titles[table_name] = table_title
 
         for name, columns in table_columns.iteritems():



More information about the Mpuls-commits mailing list