From 5d08d3b3fba946a109a4ca5151ca1f67b9042d39 Mon Sep 17 00:00:00 2001 From: Griatch Date: Tue, 5 Aug 2014 09:05:44 +0200 Subject: [PATCH] Added clear() method to nattributehandler. Resolves #542. --- src/typeclasses/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index c96b4bc93f..03d00db2ca 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -517,7 +517,7 @@ class NickHandler(AttributeHandler): class NAttributeHandler(object): """ This stand-alone handler manages non-database saving. - It is consistent with AttributeHandler and is used + It is similar to AttributeHandler and is used by the .ndb handler in the same way as .db does for the AttributeHandler. """ @@ -545,6 +545,10 @@ class NAttributeHandler(object): del self._store[key] self.obj.set_recache_protection(self._store) + def clear(self): + "Remove all nattributes from handler" + self._store = {} + def all(self, return_tuples=False): "List all keys or (keys, values) stored, except _keys" if return_tuples: