diff options
author | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2012-04-13 19:42:19 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polyconseil.fr> | 2012-04-15 10:06:39 +0200 |
commit | 0e7fed312bf2de6d628a61b116bd91e04bf0a9ff (patch) | |
tree | 103408b5bee8339eee6e510300a374b0bcea748f /factory/declarations.py | |
parent | b590e5014351a79d66d2f4816b1a6aa83908f395 (diff) | |
download | factory-boy-0e7fed312bf2de6d628a61b116bd91e04bf0a9ff.tar factory-boy-0e7fed312bf2de6d628a61b116bd91e04bf0a9ff.tar.gz |
Handle the PostGeneration declarations.
Signed-off-by: Raphaël Barrois <raphael.barrois@polyconseil.fr>
Diffstat (limited to 'factory/declarations.py')
-rw-r--r-- | factory/declarations.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/factory/declarations.py b/factory/declarations.py index d9d560a..ddc6c78 100644 --- a/factory/declarations.py +++ b/factory/declarations.py @@ -23,6 +23,8 @@ import itertools +from factory import utils + class OrderedDeclaration(object): """A factory declaration. @@ -275,12 +277,12 @@ class PostGenerationDeclaration(object): (object, dict): a tuple containing the attribute at 'name' (if provided) and a dict of extracted attributes """ - extracted = attrs.get(name) + extracted = attrs.pop(name, None) if self.extract_prefix: extract_prefix = self.extract_prefix else: extract_prefix = name - kwargs = utils.extract_dict(extract_prefix) + kwargs = utils.extract_dict(extract_prefix, attrs) return extracted, kwargs def call(self, obj, create, extracted=None, **kwargs): |