class SessionWizardView(WizardView):
@classonlymethod
def as_view(cls, *args, **kwargs):
#...snipped..
pass
class ParentWizard(SessionWizardView):
@classonlymethod
def as_view(cls, *args, **kwargs):
return super(SessionWizardView, cls).as_view( ... )
class ChildWizard(ParentWizard):
@classonlymethod
def as_view(cls, *args, **kwargs):
return super(SessionWizardView, cls).as_view( ... )
In ChildWizard, is it legal to pass in a grandparent class (SessionWizardView) into the first parameter of super ? pylint is vomiting this error message:
Method should have "self" as first argument
Bad first argument ‘SessionWizardView’ given to super class
The usual usage of super for classmethods is to put cls first and the name of the current class as the second argument:
If you build working code that passes tests, I wouldn’t worry to much about how pylint reports the naming of the first argument. pylint knows that a standard Python classmethod will use cls as the first argument, but it doesn’t know anything about classonlymethod which has the same pattern.
References: