changeset 674:690a8a80a0ad frontends_multi_profiles

browser_side: added __len__ method in OrderedDict
author Goffi <goffi@goffi.org>
date Tue, 17 Mar 2015 20:26:31 +0100
parents e489218886d7
children 941e53b3af5c
files src/browser/collections.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/collections.py	Wed Mar 11 19:01:27 2015 +0100
+++ b/src/browser/collections.py	Tue Mar 17 20:26:31 2015 +0100
@@ -32,6 +32,9 @@
             for key, value in args[0]:
                 self[key] = value
 
+    def __len__(self):
+        return len(self.__keys)
+
     def __setitem__(self, key, value):
         self.__keys.append(key)
         self.__internal_dict[key] = value
@@ -108,7 +111,7 @@
         try:
             return self.__internal_dict[key]
         except KeyError:
-            self.__internal_dict[key] = default
+            self[key] = default
             return default
 
     def update(self, *args, **kwargs):