diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-05-17 18:47:04 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-05-18 14:17:05 +0200 |
commit | 69894fce7977ea55f8cc3ad141840bab49330859 (patch) | |
tree | 07eb056883112ef58b7be037cde76c5f805c8ba2 /factory/helpers.py | |
parent | 1fdba9d9417e8f69b39784ee19129a6c43128620 (diff) | |
download | factory-boy-69894fce7977ea55f8cc3ad141840bab49330859.tar factory-boy-69894fce7977ea55f8cc3ad141840bab49330859.tar.gz |
Switch FACTORY_FOR and related to 'class Meta'.
This is easier to declare, avoids cluttering the namespace, and provides
entry points for ORM-specific customization.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'factory/helpers.py')
-rw-r--r-- | factory/helpers.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/factory/helpers.py b/factory/helpers.py index 4a2a254..0c387d0 100644 --- a/factory/helpers.py +++ b/factory/helpers.py @@ -50,7 +50,9 @@ def debug(logger='factory', stream=None): def make_factory(klass, **kwargs): """Create a new, simple factory for the given class.""" factory_name = '%sFactory' % klass.__name__ - kwargs[base.FACTORY_CLASS_DECLARATION] = klass + class Meta: + target = klass + kwargs['Meta'] = Meta base_class = kwargs.pop('FACTORY_CLASS', base.Factory) factory_class = type(base.Factory).__new__( |