diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-26 06:26:02 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-26 06:26:02 +0000 |
commit | c9cfb713ce1488dc0c1cb87bcc050e3ac0de7bcb (patch) | |
tree | 3904c0ad26933567356cf76eaf693ba3afae7a07 /lib/sqlalchemy/attributes.py | |
parent | 995d9afb831ec72757781d5b48e5b4eee0bfac28 (diff) | |
download | sqlalchemy-c9cfb713ce1488dc0c1cb87bcc050e3ac0de7bcb.tar.gz |
util: the __setitem__ method on historyarraylist was meaningless, surprising nobody noticed that.
types: added PickleType, its slightly trickier than trivial, so OK now its standard.
attributes: the level of pain if an AttributeError occurs inside a CallableProp, in combination with an object that implements __getattr__, is too deep for me to put the users through....so convert AttributeErrors to Assertions...
engine: im not a fan of catching universal exceptions and squashing them
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r-- | lib/sqlalchemy/attributes.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py index 997b2c8f8..cd01faddd 100644 --- a/lib/sqlalchemy/attributes.py +++ b/lib/sqlalchemy/attributes.py @@ -214,7 +214,12 @@ class CallableProp(object): if passive: value = None else: - value = self.callable_() + try: + value = self.callable_() + except AttributeError, e: + # this catch/raise is because this call is frequently within an + # AttributeError-sensitive callstack + raise AssertionError("AttributeError caught in callable prop:" + str(e.args)) self.obj.__dict__[self.key] = value p = PropHistory(self.obj, self.key, **self.kwargs) @@ -223,11 +228,15 @@ class CallableProp(object): if passive: value = None else: - value = self.callable_() + try: + value = self.callable_() + except AttributeError, e: + # this catch/raise is because this call is frequently within an + # AttributeError-sensitive callstack + raise AssertionError("AttributeError caught in callable prop:" + str(e.args)) else: value = None p = self.manager.create_list(self.obj, self.key, value, readonly=self.live, **self.kwargs) - if not self.live and not passive: # set the new history list as the new attribute, discards ourself self.manager.attribute_history(self.obj)[self.key] = p |