Activity log for bug #1215970

Date Who What changed Old value New value Message
2013-08-23 14:47:51 Curtis Hovey bug added bug
2013-08-23 14:51:53 Curtis Hovey description There are several places in the code where data is cast as a Charm or Bundle to normalise the data. eg bundle_data = Bundle(data)._representation There are a few problems with this pattern. The caller knows about the private member. The caller assumes that _representation is sane -- it might contain unsupported keys. The caller can mutate the dict which will change the bundle or charm object. The __init__ methods of Bundle and Charm could limit the update the _representation to keys that are supported. A property like @representation or __dict__ could return a copy of the dict to ensure only sane and normalised key-values are returned that cannot mutate the object. This pattern is common and methods do not now if the dict they are working with is a _representation. We may have code mutating objects and we do not understand the repercussions. There are several places in the code where data is cast as a Charm or Bundle to normalise the data. eg      bundle_data = Bundle(data)._representation There are a few problems with this pattern. The caller knows about the private member. The caller assumes that _representation is sane -- it might contain unsupported keys. The caller can mutate the dict which will change the bundle or charm object. The __init__ methods of Bundle and Charm could limit the update the _representation to keys that are supported. A property like @representation or __iter__ could return a copy of the dict to ensure only sane and normalised key-values are returned that cannot mutate the object. This pattern is common and methods do not now if the dict they are working with is a _representation. We may have code mutating objects and we do not understand the repercussions.
2017-05-15 13:59:33 Curtis Hovey removed subscriber Curtis Hovey