observer: Coerce scalar values in keys to sets

Unfortunately, strings are iterable in python, so without this a call with a
single string, or a construct of "('foo')" would result in creating keys for
each letter of the string 'foo'. "('foo',)" works, because , creates the tuple,
not the parens...
This commit is contained in:
June Tate-Gans 2021-05-03 18:11:28 -05:00
parent 4d11270a7c
commit 003ab3b526

View File

@ -11,6 +11,8 @@ class Observer(object):
def _makeChangeTriggerKeys(self, changeType, keys):
result = []
if keys != Subject.AllKeys:
if type(keys) != set:
keys = {keys}
for key in keys:
result.append((changeType, key))
else: