summaryrefslogtreecommitdiff
path: root/factory
diff options
context:
space:
mode:
Diffstat (limited to 'factory')
-rw-r--r--factory/base.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/factory/base.py b/factory/base.py
index ff3e558..58cd50b 100644
--- a/factory/base.py
+++ b/factory/base.py
@@ -234,6 +234,9 @@ class BaseFactory(object):
# List of arguments that should be passed as *args instead of **kwargs
FACTORY_ARG_PARAMETERS = ()
+ # List of attributes that should not be passed to the underlying class
+ FACTORY_HIDDEN_ARGS = ()
+
@classmethod
def _setup_next_sequence(cls):
"""Set up an initial sequence value for Sequence attributes.
@@ -305,6 +308,10 @@ class BaseFactory(object):
target_class = getattr(cls, CLASS_ATTRIBUTE_ASSOCIATED_CLASS)
kwargs = cls._adjust_kwargs(**kwargs)
+ # Remove 'hidden' arguments.
+ for arg in cls.FACTORY_HIDDEN_ARGS:
+ del kwargs[arg]
+
# Extract *args from **kwargs
args = tuple(kwargs.pop(key) for key in cls.FACTORY_ARG_PARAMETERS)