Subclassed DBEnum item is not equal to the super class item

Bug #727331 reported by Curtis Hovey on 2011-03-01
4
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Low
Unassigned

Bug Description

I Introduced a base class (NewSpecificationDefinitionStatus) to define items that are always available, and defined a sub class (SpecificationDefinitionStatus) that add two items that can only be used during the lifecycle. The two classes certainly define the same items, but DBEnumVariable.parse_set does not recongnise that the NEW item in the base class can (should) be equal.
      File "./lib/canonical/database/enumcol.py", line 39, in parse_set
        self._enum.name, value.enum.name))
    TypeError: DBItem from wrong type, 'SpecificationDefinitionStatus' != 'NewSpecificationDefinitionStatus'

I image the underlying issue here is that it is possible for the subclass to redefine the value of the super classes's item. I think this though may be a bug in lazr.enum. I think the items should be considered frozen. The guard in parse_set() could check if the enum is a sub class of the designated enum an verify the values are the same.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers