From: Mike Bayer Date: Fri, 29 Nov 2013 04:31:17 +0000 (-0500) Subject: - repair the "lockmode" functionality of load_on_ident(). slightly problematic X-Git-Tag: rel_0_9_0~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=248c4ef797421dec5dc7ec65bd805d5509a7abe4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - repair the "lockmode" functionality of load_on_ident(). slightly problematic here is that "lockmode" is also public in Session.refresh(). --- diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py index 93c94c9f47..dfb8f11a8c 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