]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Added internal warning in case an instance without a
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 13 May 2010 19:45:56 +0000 (15:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 13 May 2010 19:45:56 +0000 (15:45 -0400)
full PK happened to be expired and then was asked
to refresh. [ticket:1797]

CHANGES
lib/sqlalchemy/orm/mapper.py

diff --git a/CHANGES b/CHANGES
index 5762bd68ec2c87b5fea05ac2c91b9ec12a55dfe4..61cec42d251b7596da8911a80f8fb78eb59266ae 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,10 @@ CHANGES
     fail during deserialize where parent InstanceState not
     yet unserialized.  [ticket:1802]
 
+  - Added internal warning in case an instance without a 
+    full PK happened to be expired and then was asked
+    to refresh. [ticket:1797]
+
 - sql
   - expr.in_() now accepts a text() construct as the argument.
     Grouping parenthesis are added automatically, i.e. usage
index aec7794f31d8d04e2e01297b240a905843d57b63..a0f234057c58977889a66de27bd72e8c3309b965 100644 (file)
@@ -2095,6 +2095,15 @@ def _load_scalar_attributes(state, attribute_names):
         else:
             identity_key = mapper._identity_key_from_state(state)
         
+        if (_none_set.issubset(identity_key) and \
+                not mapper.allow_partial_pks) or \
+                _none_set.issuperset(identity_key):
+            util.warn("Instance %s to be refreshed doesn't "
+                        "contain a full primary key - can't be refreshed "
+                        "(and shouldn't be expired, either)." 
+                        % state_str(state))
+            return
+        
         result = session.query(mapper)._get(
                                             identity_key, 
                                             refresh_state=state,