diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-05-31 14:06:45 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2014-05-31 14:06:45 +0200 |
commit | ad056787937844809b48dd36311dac0f8bd4c0ab (patch) | |
tree | 1738064a62e19441d2bd5a49a559a434c8187dd4 | |
parent | 790e8ea2db7a68d7074809124dfd82c3b05b925b (diff) | |
download | factory-boy-ad056787937844809b48dd36311dac0f8bd4c0ab.tar factory-boy-ad056787937844809b48dd36311dac0f8bd4c0ab.tar.gz |
doc: Document upgrade path for FACTORY_*.
-rw-r--r-- | docs/changelog.rst | 19 | ||||
-rw-r--r-- | docs/orms.rst | 10 | ||||
-rw-r--r-- | docs/reference.rst | 12 |
3 files changed, 39 insertions, 2 deletions
diff --git a/docs/changelog.rst b/docs/changelog.rst index e5d76c7..b84ebc3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -17,6 +17,25 @@ ChangeLog *Deprecation:* - Use of ``FACTORY_FOR`` and other ``FACTORY`` class-level attributes is deprecated and will be removed in 2.5. + Those attributes should now declared within the :class:`class Meta <factory.FactoryOptions>` attribute: + + For :class:`factory.Factory`: + + * Rename :attr:`~factory.Factory.FACTORY_FOR` to :attr:`~factory.FactoryOptions.model` + + * Rename :attr:`~factory.Factory.FACTORY_FOR` to :attr:`~factory.FactoryOptions.model` + * Rename :attr:`~factory.Factory.ABSTRACT_FACTORY` to :attr:`~factory.FactoryOptions.abstract` + * Rename :attr:`~factory.Factory.FACTORY_STRATEGY` to :attr:`~factory.FactoryOptions.strategy` + * Rename :attr:`~factory.Factory.FACTORY_ARG_PARAMETERS` to :attr:`~factory.FactoryOptions.inline_args` + * Rename :attr:`~factory.Factory.FACTORY_HIDDEN_ARGS` to :attr:`~factory.FactoryOptions.exclude` + + For :class:`factory.django.DjangoModelFactory`: + + * Rename :attr:`~factory.django.DjangoModelFactory.FACTORY_DJANGO_GET_OR_CREATE` to :attr:`~factory.django.DjangoOptions.django_get_or_create` + + For :class:`factory.alchemy.SQLAlchemyModelFactory`: + + * Rename :attr:`~factory.alchemy.SQLAlchemyModelFactory.FACTORY_SESSION` to :attr:`~factory.alchemy.SQLAlchemyOptions.sqlalchemy_session` .. _v2.3.1: diff --git a/docs/orms.rst b/docs/orms.rst index 6a942a6..2aa27b2 100644 --- a/docs/orms.rst +++ b/docs/orms.rst @@ -273,7 +273,7 @@ SQLAlchemy Factoy_boy also supports `SQLAlchemy`_ models through the :class:`SQLAlchemyModelFactory` class. -To work, this class needs an `SQLAlchemy`_ session object affected to the ``Meta.sqlalchemy_session`` attribute. +To work, this class needs an `SQLAlchemy`_ session object affected to the :attr:`Meta.sqlalchemy_session <SQLAlchemyOptions.sqlalchemy_session>` attribute. .. _SQLAlchemy: http://www.sqlalchemy.org/ @@ -286,6 +286,11 @@ To work, this class needs an `SQLAlchemy`_ session object affected to the ``Meta * :func:`~factory.Factory.create()` uses :meth:`sqlalchemy.orm.session.Session.add` * :func:`~factory.Factory._setup_next_sequence()` selects the next unused primary key value + .. attribute:: FACTORY_SESSION + + .. deprecated:: 2.4.0 + See :attr:`~SQLAlchemyOptions.sqlalchemy_session`. + .. class:: SQLAlchemyOptions(factory.base.FactoryOptions) In addition to the usual parameters available in :class:`class Meta <factory.base.FactoryOptions>`, @@ -293,7 +298,8 @@ To work, this class needs an `SQLAlchemy`_ session object affected to the ``Meta .. attribute:: sqlalchemy_session - Fields whose SQLAlchemy session object are passed will be used to communicate with the database + SQLAlchemy session to use to communicate with the database when creating + an object through this :class:`SQLAlchemyModelFactory`. A (very) simple exemple: diff --git a/docs/reference.rst b/docs/reference.rst index 25fef22..b0dda50 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -106,6 +106,13 @@ The :class:`Factory` class .. versionadded:: 2.4.0 + .. attribute:: strategy + + Use this attribute to change the strategy used by a :class:`Factory`. + The default is :data:`BUILD_STRATEGY`. + + + .. class:: Factory .. note:: In previous versions, the fields of :class:`class Meta <factory.FactoryOptions>` were @@ -132,6 +139,11 @@ The :class:`Factory` class .. deprecated:: 2.4.0 See :attr:`FactoryOptions.exclude`. + .. attribute:: FACTORY_STRATEGY + + .. deprecated:: 2.4.0 + See :attr:`FactoryOptions.strategy`. + **Class-level attributes:** |