[Zope] TinyTablePlus bug: key non-string columns not shown with '*'

J M Cerqueira Esteves jmce@artenumerica.com
Fri, 11 Jan 2002 14:33:54 +0000


Using the TinyTablePlus properties editor, I noticed that whenever I
specified a key column which had a non-string type, for instance with
 
      vol_id*:int  .... 

(adding the '*' after the name) and submitted this, the column spec
would come back as

      vol_id:int ....

as if vol_id had not been turned into a key column.

This is due to a bug in method cols_text (), which is called by Edit.dtml
to show the column spec.  cols_text () was never recognizing such
explicitly typed columns as keys because it was searching
their names in the key columns list AFTER appending the ":type" suffix.

This is solved by a simple patch to TinyTablePlus.py:

--- TinyTablePlus.py~   Thu Apr 13 16:30:00 2000
+++ TinyTablePlus.py    Fri Jan 11 14:03:01 2002
@@ -516,10 +516,10 @@
 
         for i in range(0, self.n_cols):
             # Modified by SDH for key_cols.
-            name = self._col_names[i] + TypeNames[self._types[i]]
+            name = self._col_names[i]
             if hasattr(self, '_key_cols') and name in self._key_cols:
                 name = name + '*'
-            l.append(name)
+            l.append(name + TypeNames[self._types[i]])
 
         return string.join(l, ' ')