Trying to figure out how to write multiple mixins for a Django control command that will wrap BaseCommand.option_list without losing the value of the current class or any inherited classes / mixins. The goal is to avoid doing BaseCommand.option_list + MyCommonOptionMixin.option_list + MyOtherCommonOptionMixin.option_list + ( local command options ) in my commands.
Example:
class BaseCommmand(object): option_list = (
I define mixin with some common parameters:
class MyCommonOptionMixin(object): option_list = (
Maybe I have one more, just to cover the case when I have a lot. Mixins redefine __getattribute__
class MyOtherCommonOptionMixin(object): option_list = (
I ran into a conflict if mixins use the same name for the option_list property. Is there a cleaner way to achieve this than the unique identifier option_list inside mixins and overriding __getattribute__ ?
source share