diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-17 17:48:29 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-03-17 17:48:29 -0400 |
commit | 065fcbd9d2b463920d439c20d99a5a1cd7f216ed (patch) | |
tree | 2230349df4cc7bc884f128e2c463c2e334152b7e /lib/sqlalchemy/ext/orderinglist.py | |
parent | 95c0214356a55b6bc051d2b779e54d6de7b0b22e (diff) | |
download | sqlalchemy-065fcbd9d2b463920d439c20d99a5a1cd7f216ed.tar.gz |
- The official name for the relation() function is now
relationship(), to eliminate confusion over the relational
algebra term. relation() however will remain available
in equal capacity for the foreseeable future. [ticket:1740]
Diffstat (limited to 'lib/sqlalchemy/ext/orderinglist.py')
-rw-r--r-- | lib/sqlalchemy/ext/orderinglist.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sqlalchemy/ext/orderinglist.py b/lib/sqlalchemy/ext/orderinglist.py index 8e63ed1c2..db0bd2a4e 100644 --- a/lib/sqlalchemy/ext/orderinglist.py +++ b/lib/sqlalchemy/ext/orderinglist.py @@ -1,17 +1,17 @@ """A custom list that manages index/position information for its children. ``orderinglist`` is a custom list collection implementation for mapped -relations that keeps an arbitrary "position" attribute on contained objects in +relationships that keeps an arbitrary "position" attribute on contained objects in sync with each object's position in the Python list. The collection acts just like a normal Python ``list``, with the added behavior that as you manipulate the list (via ``insert``, ``pop``, assignment, deletion, what have you), each of the objects it contains is updated as needed -to reflect its position. This is very useful for managing ordered relations +to reflect its position. This is very useful for managing ordered relationships which have a user-defined, serialized order:: >>> from sqlalchemy import MetaData, Table, Column, Integer, String, ForeignKey - >>> from sqlalchemy.orm import mapper, relation + >>> from sqlalchemy.orm import mapper, relationship >>> from sqlalchemy.ext.orderinglist import ordering_list A simple model of users their "top 10" things:: @@ -32,7 +32,7 @@ A simple model of users their "top 10" things:: ... self.blurb = blurb ... >>> mapper(User, users, properties={ - ... 'topten': relation(Blurb, collection_class=ordering_list('position'), + ... 'topten': relationship(Blurb, collection_class=ordering_list('position'), ... order_by=[blurbs.c.position])}) <Mapper ...> >>> mapper(Blurb, blurbs) @@ -73,7 +73,7 @@ __all__ = [ 'ordering_list' ] def ordering_list(attr, count_from=None, **kw): """Prepares an OrderingList factory for use in mapper definitions. - Returns an object suitable for use as an argument to a Mapper relation's + Returns an object suitable for use as an argument to a Mapper relationship's ``collection_class`` option. Arguments are: attr @@ -136,7 +136,7 @@ class OrderingList(list): See the module and __init__ documentation for more details. The ``ordering_list`` factory function is used to configure ``OrderingList`` - collections in ``mapper`` relation definitions. + collections in ``mapper`` relationship definitions. """ @@ -149,11 +149,11 @@ class OrderingList(list): mapped objects. This implementation relies on the list starting in the proper order, - so be **sure** to put an ``order_by`` on your relation. + so be **sure** to put an ``order_by`` on your relationship. ordering_attr Name of the attribute that stores the object's order in the - relation. + relationship. ordering_func Optional. A function that maps the position in the Python list to a |