[Toaster] Changing code constants to reflect package type display strings and ordering

Lerner, Dave dave.lerner at windriver.com
Sat Jan 18 10:27:54 PST 2014


Hi Alex, Belen

We have view specs regarding ordering and display values for package_dependencies.

The non RDEPENDS releationship types are to be sorted in this order and displayed with these strings:

1. Recommends
2. Suggests
3. Provides
4. Replaces
5. Conflicts

These two constraints do not map directly to what I'm guessing is an arbitrary set of constants in Package_Dependency.DEPENDS_TYPE in models.py.  I couldn't find references to this list outside of the package detail source file.  

Can we change...
class Package_Dependency(models.Model):
    TYPE_RDEPENDS = 0
    TYPE_RPROVIDES = 1
    TYPE_RRECOMMENDS = 2
    TYPE_RSUGGESTS = 3
    TYPE_RREPLACES = 4
    TYPE_RCONFLICTS = 5
    TYPE_TRDEPENDS = 6
    TYPE_TRECOMMENDS = 7
    DEPENDS_TYPE = (
        (TYPE_RDEPENDS, "rdepends"),
        (TYPE_RPROVIDES, "rprovides"),
        (TYPE_RRECOMMENDS, "rrecommends"),
        (TYPE_RSUGGESTS, "rsuggests"),
        (TYPE_RREPLACES, "rreplaces"),
        (TYPE_RCONFLICTS, "rconflicts"),
        (TYPE_TRDEPENDS, "trdepends"),
        (TYPE_TRECOMMENDS, "trecommends"),
    )
to...
    TYPE_RDEPENDS = 1
    TYPE_TRDEPENDS = 2
    TYPE_RRECOMMENDS = 3
    TYPE_TRECOMMENDS = 4
    TYPE_RSUGGESTS = 5
    TYPE_RPROVIDES = 6
    TYPE_RREPLACES = 7
    TYPE_RCONFLICTS = 8
    DEPENDS_TYPE = (
        (TYPE_RDEPENDS, "Depends"),
        (TYPE_TRDEPENDS, "Depends"),
        (TYPE_RRECOMMENDS, "Recommends"),
        (TYPE_TRECOMMENDS, "Recommends"),
        (TYPE_RPROVIDES, "Provids"),
        (TYPE_RSUGGESTS, "Suggests"),
        (TYPE_RREPLACES, "Replaces"),
        (TYPE_RCONFLICTS, "Conflicts"),
    )

With this change, the database values map to correct display order and the list maps to display strings.  I haven't looked at every other spec, though to see if any other ordering of relationship types is required.

Ok to include this change?
Dave


More information about the toaster mailing list