From b590e5014351a79d66d2f4816b1a6aa83908f395 Mon Sep 17 00:00:00 2001 From: Raphaël Barrois Date: Fri, 13 Apr 2012 19:33:54 +0200 Subject: Add PostGenerationDeclarationDict (cf. DeclarationDict). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- factory/containers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/factory/containers.py b/factory/containers.py index b8557d6..9f480cc 100644 --- a/factory/containers.py +++ b/factory/containers.py @@ -149,13 +149,21 @@ class DeclarationDict(dict): Args: extra (dict): additional attributes to include in the copy. """ - new = DeclarationDict() + new = self.__class__() new.update(self) if extra: new.update(extra) return new +class PostGenerationDeclarationDict(DeclarationDict): + """Alternate DeclarationDict for PostGenerationDeclaration.""" + + def is_declaration(self, name, value): + """Captures instances of PostGenerationDeclaration.""" + return isinstance(value, declarations.PostGenerationDeclaration) + + class LazyValue(object): """Some kind of "lazy evaluating" object.""" -- cgit v1.2.3