summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-01-21 17:59:14 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-01-21 17:59:14 -0500
commitd455a4196d160e616401dceaf65741d5f7fb662c (patch)
treec3b1df543c6922377af59d876e6950bc8bccea3b /lib/sqlalchemy
parentb1a01a6256e29b47b79baeb5671d662fc021c069 (diff)
parent2e627a62ea3234b07c59d818bca6e37fdcea29ee (diff)
downloadsqlalchemy-d455a4196d160e616401dceaf65741d5f7fb662c.tar.gz
Merged in lerks/sqlalchemy (pull request #36)
Fix the collection.link decorator
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/collections.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index 620c20910..3047a5d26 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -292,8 +292,8 @@ class collection(object):
The decorators fall into two groups: annotations and interception recipes.
- The annotating decorators (appender, remover, iterator,
- internally_instrumented, link) indicate the method's purpose and take no
+ The annotating decorators (appender, remover, iterator, linker, converter,
+ internally_instrumented) indicate the method's purpose and take no
arguments. They are not written with parens::
@collection.appender
@@ -419,7 +419,7 @@ class collection(object):
return fn
@staticmethod
- def link(fn):
+ def linker(fn):
"""Tag the method as a the "linked to attribute" event handler.
This optional event handler will be called when the collection class
@@ -429,7 +429,7 @@ class collection(object):
that has been linked, or None if unlinking.
"""
- setattr(fn, '_sa_instrument_role', 'link')
+ setattr(fn, '_sa_instrument_role', 'linker')
return fn
@staticmethod
@@ -609,14 +609,14 @@ class CollectionAdapter(object):
def link_to_self(self, data):
"""Link a collection to this adapter, and fire a link event."""
setattr(data, '_sa_adapter', self)
- if hasattr(data, '_sa_on_link'):
- getattr(data, '_sa_on_link')(self)
+ if hasattr(data, '_sa_linker'):
+ getattr(data, '_sa_linker')(self)
def unlink(self, data):
"""Unlink a collection from any adapter, and fire a link event."""
setattr(data, '_sa_adapter', None)
- if hasattr(data, '_sa_on_link'):
- getattr(data, '_sa_on_link')(None)
+ if hasattr(data, '_sa_linker'):
+ getattr(data, '_sa_linker')(None)
def adapt_like_to_iterable(self, obj):
"""Converts collection-compatible objects to an iterable of values.
@@ -921,7 +921,7 @@ def _instrument_class(cls):
if hasattr(method, '_sa_instrument_role'):
role = method._sa_instrument_role
assert role in ('appender', 'remover', 'iterator',
- 'link', 'converter')
+ 'linker', 'converter')
roles[role] = name
# transfer instrumentation requests from decorated function