diff -r c1538e5ac532 -r 9fd7d496e27e cubicweb/utils.py --- a/cubicweb/utils.py Tue Apr 24 15:21:38 2018 +0200 +++ b/cubicweb/utils.py Tue Apr 24 17:30:43 2018 +0200 @@ -627,6 +627,18 @@ with self._lock: return len(self._data) + def get(self, k, default=None): + """Get the value associated to the specified key + + :param k: The key to look for + :param default: The default value when the key is not found + :return: The associated value (or the default value) + """ + try: + return self._data[k] + except KeyError: + return default + def __getitem__(self, k): with self._lock: if k in self._permanent: