pyventory
pyventory copied to clipboard
Allow to override parts of the complex structures
Allow overriding parts of the structures defined using complex dicts structures like the following
class MyAsset(Asset):
complex_var = dict(
key1=dict(
sub_key1='sub_value1',
sub_key2='sub_value2',
)
key2='value2',
)
Well, it looks like in most cases this could be achieved by creation of a mixin that handles variables extracted from the original asset. Consider the following example.
class OriginalAsset(Asset):
foo = dict(
key1='value1',
key2='value2',
)
This could be represented in the following way
class Key1Mixin:
foo_key1 = 'value1'
class OriginalAsset(Key1Mixin, Asset):
foo = dict(
key2='value2',
)
or just
class OriginalAsset(Asset):
foo = dict(
key2='value2',
)
foo_key1 = 'value1'
I'm going to concentrate on the other features for now. Let's look how Scopes feature implementation will affect this.