# HG changeset patch # User Thinker K.F. Li # Date 1303047289 -28800 # Node ID 28769a82a72d4fb26ec18516f63e1d13bbe38e64 # Parent 5ff744b981fb782bf405e77f5b364ea4f5562df9 Raise a maningful exception for traits that is not ready diff -r 5ff744b981fb -r 28769a82a72d pyink/trait.py --- 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