Opened 11 years ago

Closed 11 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

Description

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

gives:

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 by Aymeric Augustin, 11 years ago

Resolution: invalid
Status: newclosed

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