Opened 2 years ago

Closed 2 years ago

#21011 closed Uncategorized (invalid)

It should be possible for model classes to have abstract methods

Reported by: steven_ganz Owned by: nobody
Component: Uncategorized Version: 1.5
Severity: Normal Keywords: ABCMeta
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


This is 'abstract' in terms of ABCMeta and has nothing to do with setting 'abstract = True' (i.e., use of abstract methods should be possible regardless of the setting of 'abstract')

Any attempt to set

__metaclass__ = ABCMeta


TypeError: Error when calling the metaclass bases
    metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Unfortunately, the solution is not as simple as setting this attribute for Model and ModelBase.

Change History (1)

comment:1 Changed 2 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

In this scenario __metaclass__ must be a subclass of both Model's metaclass (namely ModelBase) and ABCMeta.

I would advise against using metaclasses if the above isn't obvious to you.

Note: See TracTickets for help on using tickets.
Back to Top