def default_listener(col_attr, default):
"""Establish a default-setting listener.
- Given a class_, attrname, and a :class:`.DefaultGenerator` instance.
+ Given a class attribute and a :class:`.DefaultGenerator` instance.
The default generator should be a :class:`.ColumnDefault` object with a
plain Python value or callable default; otherwise, the appropriate behavior
for SQL functions and defaults should be determined here by the
return self._as_instance(class_, obj).delete(obj)
def for_class(self, class_, obj=None):
- """Return the internal state local to a specific mapped class.
+ r"""Return the internal state local to a specific mapped class.
E.g., given a class ``User``::
is specific to the ``User`` class. The :class:`.AssociationProxy`
object remains agnostic of its parent class.
- :param class_: the class that we are returning state for.
+ :param class\_: the class that we are returning state for.
:param obj: optional, an instance of the class that is required
if the attribute refers to a polymorphic target, e.g. where we have
"""
def init_scalar(self, target, value, dict_):
- """Receive a scalar "init" event.
+ r"""Receive a scalar "init" event.
This event is invoked when an uninitialized, unpersisted scalar
attribute is accessed, e.g. read::
listener were invoked. This value begins as the value ``None``,
however will be the return value of the previous event handler
function if multiple listeners are present.
- :param dict_: the attribute dictionary of this mapped object.
+ :param dict\_: the attribute dictionary of this mapped object.
This is normally the ``__dict__`` of the object, but in all cases
represents the destination that the attribute system uses to get
at the actual value of this attribute. Placing the value in this
def _configure_class_instrumentation(self):
"""If this mapper is to be a primary mapper (i.e. the
non_primary flag is not set), associate this Mapper with the
- given class_ and entity name.
+ given class and entity name.
- Subsequent calls to ``class_mapper()`` for the class_/entity
+ Subsequent calls to ``class_mapper()`` for the ``class_`` / ``entity``
name combination will return this mapper. Also decorate the
`__init__` method on the mapped class to include optional
auto-session attachment logic.
return self._subclass_load_via_in(self)
def cascade_iterator(self, type_, state, halt_on=None):
- """Iterate each element and its mapper in an object graph,
+ r"""Iterate each element and its mapper in an object graph,
for all relationships that meet the given cascade rule.
- :param type_:
+ :param type\_:
The name of the cascade rule (i.e. ``"save-update"``, ``"delete"``,
etc.).
:param bind: a :class:`.Engine` or other :class:`.Connectable` with
which newly created :class:`.Session` objects will be associated.
- :param class_: class to use in order to create new :class:`.Session`
+ :param class\_: class to use in order to create new :class:`.Session`
objects. Defaults to :class:`.Session`.
:param autoflush: The autoflush setting to use with newly created
:class:`.Session` objects.