Commit 2b94959d authored by Vincent Pelletier's avatar Vincent Pelletier

ZSQLCatalog: Tolerate non-existent tables in sql_search_tables.

Such tables are not visible in the ZMI (which is arguably a bug on its
own, although the ZMI is deprecated), but even accessing the setting
tab is broken as it runs these methods.
This change at least allows accessing stuff to start fixing.
parent 86e9f0ae
......@@ -1033,7 +1033,7 @@ class Catalog(Folder,
add_key = keys.add
table_dict = self._getCatalogSchema()
for table in self.getCatalogSearchTableIds():
for field in table_dict[table]:
for field in table_dict.get(table, ()):
add_key(field)
add_key('%s.%s' % (table, field)) # Is this inconsistent ?
for related in self.getSQLCatalogRelatedKeyList():
......@@ -1054,7 +1054,7 @@ class Catalog(Folder,
result = {}
table_dict = self._getCatalogSchema()
for table in self.getCatalogSearchTableIds():
for field in table_dict[table]:
for field in table_dict.get(table, ()):
result.setdefault(field, []).append(table)
result.setdefault('%s.%s' % (table, field), []).append(table) # Is this inconsistent ?
return result
......@@ -1069,7 +1069,7 @@ class Catalog(Folder,
keys = set()
table_dict = self._getCatalogSchema()
for table in self.getCatalogSearchTableIds():
for field in table_dict[table]:
for field in table_dict.get(table, ()):
keys.add('%s.%s' % (table, field))
return sorted(keys)
......
  • Thanks for the fix. It also solves the broken UI problem while installing some BT which have catalog methods that create a new non-existing table and update properties of Catalog.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment