Commit
- Loading branch information
There are no files selected for viewing
2 comments
on commit 3ae477b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
I'm a little worried with setattr(c.__class__, item_name, property(get_item))
is it thread safe?
To be honest I've no real comprehension of how c works I've look at some of the code but it was a bit too convoluted for my patience
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setattr(c.__class__, item_name, property(get_item))
does not look thread safe to me.
I also do not like tobes WrappedContextItem as it seems unnecessary and has a risk of not supporting all types of objects.
I would monkey patch the context classes __getattr__
like in tobes solution (probably at startup) but add something on the context instance like
c.__depricated_properties__ = { 'facet': 'facet deprication message' , ...}
c.__depricated_properties__
would populated and/or created by this function.
The overridden __getattr__
would check to see if c.__depricated_properties__
exists and if the name was in there then throw the warning. Then it would call the original context classes __getattr__
.
The only downside of this is another hidden variable.
This should be
self is c
, notself == c