Commit 461c3097 authored by Vincent Pelletier's avatar Vincent Pelletier

Warn about related keys named after real columns and duplicate related keys only once per zope run.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26528 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4db80088
...@@ -225,6 +225,7 @@ class UidBuffer(TM): ...@@ -225,6 +225,7 @@ class UidBuffer(TM):
self.temporary_buffer.setdefault(tid, []).extend(iterable) self.temporary_buffer.setdefault(tid, []).extend(iterable)
related_key_definition_cache = {} related_key_definition_cache = {}
related_key_warned_column_set = set()
class Catalog(Folder, class Catalog(Folder,
Persistent, Persistent,
...@@ -1740,7 +1741,9 @@ class Catalog(Folder, ...@@ -1740,7 +1741,9 @@ class Catalog(Folder,
LOG('SQLCatalog', WARNING, 'Malformed related key definition: %r. Ignored.' % (related_key, )) LOG('SQLCatalog', WARNING, 'Malformed related key definition: %r. Ignored.' % (related_key, ))
continue continue
related_key_id = split_entire_definition[0].strip() related_key_id = split_entire_definition[0].strip()
if related_key_id in column_set: if related_key_id in column_set and \
related_key_id not in related_key_warned_column_set:
related_key_warned_column_set.add(related_key_id)
if related_key_id in column_map: if related_key_id in column_map:
LOG('SQLCatalog', WARNING, 'Related key %r has the same name as an existing column on tables %r' % (related_key_id, column_map[related_key_id])) LOG('SQLCatalog', WARNING, 'Related key %r has the same name as an existing column on tables %r' % (related_key_id, column_map[related_key_id]))
else: else:
......
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