Mercurial > MadButterfly
changeset 1464:28769a82a72d
Raise a maningful exception for traits that is not ready
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 17 Apr 2011 21:34:49 +0800 |
parents | 5ff744b981fb |
children | a3ce8d22d163 |
files | pyink/trait.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pyink/trait.py Sun Apr 17 21:29:16 2011 +0800 +++ b/pyink/trait.py Sun Apr 17 21:34:49 2011 +0800 @@ -19,7 +19,11 @@ def __set__(self, instance, value): attrname = instance._trait_attrname_map[self] - composite_obj = instance._trait_composite_obj + try: + composite_obj = instance._trait_composite_obj + except AttributeError: + raise RuntimeError, \ + '%s does not finish its initialization' % (repr(instance)) setattr(composite_obj, attrname, value) pass pass