summaryrefslogtreecommitdiff
path: root/docs/reference.rst
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2013-08-13 12:06:52 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-08-13 12:11:09 +0200
commit2796de70d5bed4cfff5749085ce4e6f16eba1b1e (patch)
tree71fbfd55fdebfce3faf44426731d7dd7bbf78efd /docs/reference.rst
parent5730d4ac18f8684c37168033ef32d1ee31f5e4a1 (diff)
downloadfactory-boy-2796de70d5bed4cfff5749085ce4e6f16eba1b1e.tar
factory-boy-2796de70d5bed4cfff5749085ce4e6f16eba1b1e.tar.gz
Make ABSTRACT_FACTORY optional (Closes #74)
It will be automatically set to True if neither the Factory subclass nor its parents define a FACTORY_FOR argument. It can also be set on a Factory subclass to prevent it from being called.
Diffstat (limited to 'docs/reference.rst')
-rw-r--r--docs/reference.rst11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/reference.rst b/docs/reference.rst
index e98665f..3d3097d 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -19,15 +19,18 @@ The :class:`Factory` class
.. attribute:: FACTORY_FOR
- This required attribute describes the class of objects to generate.
- It may only be absent if the factory has been marked abstract through
- :attr:`ABSTRACT_FACTORY`.
+ This optional attribute describes the class of objects to generate.
+
+ If unset, it will be inherited from parent :class:`Factory` subclasses.
.. attribute:: ABSTRACT_FACTORY
This attribute indicates that the :class:`Factory` subclass should not
be used to generate objects, but instead provides some extra defaults.
+ It will be automatically set to ``True`` if neither the :class:`Factory`
+ subclass nor its parents define the :attr:`~Factory.FACTORY_FOR` attribute.
+
.. attribute:: FACTORY_ARG_PARAMETERS
Some factories require non-keyword arguments to their :meth:`~object.__init__`.
@@ -211,7 +214,7 @@ The :class:`Factory` class
.. code-block:: python
class BaseBackendFactory(factory.Factory):
- ABSTRACT_FACTORY = True
+ ABSTRACT_FACTORY = True # Optional
def _create(cls, target_class, *args, **kwargs):
obj = target_class(*args, **kwargs)