Mercurial > urwid-satext
diff urwid_satext/keys.py @ 86:ea5b9a211bbb
added namespace check in keys.ActionMap.set_close_namespaces
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 04 Sep 2014 18:43:39 +0200 |
parents | e0c8274f9b1c |
children | a0dbf973befa |
line wrap: on
line diff
--- a/urwid_satext/keys.py Thu Sep 04 17:13:19 2014 +0200 +++ b/urwid_satext/keys.py Thu Sep 04 18:43:39 2014 +0200 @@ -110,6 +110,9 @@ assert isinstance(close_namespaces, tuple) if always_check is not None: assert isinstance(always_check, tuple) + to_check = reduce(lambda ns1, ns2: ns1.union(ns2), close_namespaces, set(always_check) or set()) + if not to_check.issubset(self._namespaces_actions): + raise ValueError("Unkown namespaces: {}".format(', '.join(to_check.difference(self._namespaces_actions)))) self._close_namespaces = close_namespaces self._alway_check_namespaces = always_check