From: Mike Bayer Date: Thu, 5 Jan 2006 04:32:54 +0000 (+0000) Subject: better exception catch X-Git-Tag: rel_0_1_0~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef3c04aadb0a415dd7a204ce3358343a4ebd8415;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git better exception catch --- diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py index c04e5e3a10..d84ece1f6e 100644 --- a/lib/sqlalchemy/attributes.py +++ b/lib/sqlalchemy/attributes.py @@ -270,8 +270,9 @@ class AttributeManager(object): def get_attribute(self, obj, key, **kwargs): """returns the value of an object's scalar attribiute.""" + h = self.get_history(obj, key, **kwargs) try: - return self.get_history(obj, key, **kwargs).getattr() + return h.getattr() except KeyError: raise AttributeError(key)