All pastes #799089 Raw Edit

Unnamed

public text v1 · immutable
#799089 ·published 2007-11-27 09:11 UTC
rendered paste body
  File "/home/phil/devel/pigment/trunk/libs/pypgmtools/graph/group.py", line 27, in <module>
    class Group(gobject.GObject):
  File "/home/phil/devel/pigment/trunk/libs/pypgmtools/utils/classinit.py", line 15, in __new__
    cls = type.__new__(meta, class_name, bases, new_attrs)
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

My Group definition:

class Group(gobject.GObject):

    __metaclass__ = classinit.ClassInitMeta
    __classinit__ = classinit.build_properties

    ....

gobject.type_register(Group)

classinit:

class ClassInitMeta(type):

    def __new__(meta, class_name, bases, new_attrs):
        cls = type.__new__(meta, class_name, bases, new_attrs)
        if (new_attrs.has_key('__classinit__')
            and not isinstance(cls.__classinit__, staticmethod)):
            setattr(cls, '__classinit__',
                    staticmethod(cls.__classinit__.im_func))
        if hasattr(cls, '__classinit__'):
            cls.__classinit__(cls, new_attrs)
        return cls