summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/attributes.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r--lib/sqlalchemy/attributes.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py
index f87f4de9d..29a79edd2 100644
--- a/lib/sqlalchemy/attributes.py
+++ b/lib/sqlalchemy/attributes.py
@@ -267,12 +267,14 @@ class AttributeManager(object):
return CallableProp(self, func, obj, key, uselist, **kwargs)
def get_attribute(self, obj, key, **kwargs):
- """returns the value of an object's scalar attribiute."""
+ """returns the value of an object's scalar attribute, or None if
+ its not defined on the object (since we are a property accessor, this
+ is considered more appropriate than raising AttributeError)."""
h = self.get_history(obj, key, **kwargs)
try:
return h.getattr()
except KeyError:
- raise AttributeError(key)
+ return None
def get_list_attribute(self, obj, key, **kwargs):
"""returns the value of an object's list-based attribute."""