diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/changelog.rst | 11 | ||||
-rw-r--r-- | docs/reference.rst | 11 |
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) |