From ad056787937844809b48dd36311dac0f8bd4c0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Sat, 31 May 2014 14:06:45 +0200 Subject: doc: Document upgrade path for FACTORY_*. --- docs/changelog.rst | 19 +++++++++++++++++++ docs/orms.rst | 10 ++++++++-- docs/reference.rst | 12 ++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) (limited to 'docs') 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 ` 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 ` 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 `, @@ -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 ` 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:** -- cgit v1.2.3