summaryrefslogtreecommitdiff
path: root/docs
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
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')
-rw-r--r--docs/changelog.rst11
-rw-r--r--docs/reference.rst11
2 files changed, 18 insertions, 4 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst
index f9302ad..ec47b14 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -1,6 +1,17 @@
ChangeLog
=========
+.. _v2.1.2:
+
+2.1.2 (current)
+---------------
+
+*New:*
+
+ - The :class:`~factory.Factory.ABSTRACT_FACTORY` keyword is now optional, and automatically set
+ to ``True`` if neither the :class:`~factory.Factory` subclass nor its parent declare the
+ :class:`~factory.Factory.FACTORY_FOR` attribute (:issue:`74`)
+
.. _v2.1.1:
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)