summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/loading.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-11-28 23:31:17 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-11-28 23:31:17 -0500
commit248c4ef797421dec5dc7ec65bd805d5509a7abe4 (patch)
tree5c2685b0e9397da112a71c9abc3a0eaa5ea1cd4f /lib/sqlalchemy/orm/loading.py
parent31cecebd4831fbf58310509c1486244a532d96b9 (diff)
downloadsqlalchemy-248c4ef797421dec5dc7ec65bd805d5509a7abe4.tar.gz
- repair the "lockmode" functionality of load_on_ident(). slightly problematic
here is that "lockmode" is also public in Session.refresh().
Diffstat (limited to 'lib/sqlalchemy/orm/loading.py')
-rw-r--r--lib/sqlalchemy/orm/loading.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py
index 93c94c9f4..dfb8f11a8 100644
--- a/lib/sqlalchemy/orm/loading.py
+++ b/lib/sqlalchemy/orm/loading.py
@@ -174,8 +174,6 @@ def load_on_ident(query, key,
only_load_props=None):
"""Load the given identity key from the database."""
- lockmode = lockmode or query._lockmode
-
if key is not None:
ident = key[1]
else:
@@ -213,10 +211,17 @@ def load_on_ident(query, key,
q._params = params
if lockmode is not None:
- q._lockmode = lockmode
+ version_check = True
+ q = q.with_lockmode(lockmode)
+ elif query._for_update_arg is not None:
+ version_check = True
+ q._for_update_arg = query._for_update_arg
+ else:
+ version_check = False
+
q._get_options(
populate_existing=bool(refresh_state),
- version_check=(lockmode is not None),
+ version_check=version_check,
only_load_props=only_load_props,
refresh_state=refresh_state)
q._order_by = None