Change-Id: I5ad44362515908592f1e8b1e6254a5270d43234a
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/295
exists in 1.0.x as well, however in 1.1 is more noticeable as
hybrid_property @expression now returns a wrapped element.
+ .. change::
+ :tags: change, orm, declarative
+
+ Constructing a declarative base class that inherits from another class
+ will also inherit its docstring. This means
+ :func:`~.ext.declarative.as_declarative` acts more like a normal class
+ decorator.
+
.. changelog::
:version: 1.1.0b3
:released: July 26, 2016
compatible callable to use as the meta type of the generated
declarative base class.
+ .. versionchanged:: 1.1 if :paramref:`.declarative_base.cls` is a single class (rather
+ than a tuple), the constructed base class will inherit its docstring.
+
.. seealso::
:func:`.as_declarative`
class_dict = dict(_decl_class_registry=class_registry,
metadata=lcl_metadata)
+ if isinstance(cls, type):
+ class_dict['__doc__'] = cls.__doc__
+
if constructor:
class_dict['__init__'] = constructor
if mapper:
]
)
+ def test_cls_docstring(self):
+
+ class MyBase(object):
+ """MyBase Docstring"""
+
+ Base = decl.declarative_base(cls=MyBase)
+
+ eq_(Base.__doc__, MyBase.__doc__)
+
def _produce_test(inline, stringbased):