ConfigurationGroup.items method is broken

Issue #36 new
Rafal Stozek
created an issue

Because of some "funny" (not really) modifications in ConfigurationGroup.values() method items() is unable to return valid results (in my case some of the settings had values of other settings).

Comments (2)

  1. Hynek Cernoch

    Can it be reproduced with more information? Do you see old values or values of a different site or completely differently?.

    I am finishing a fix of all clear issues.

  2. Hynek Cernoch

    Yes, it was a strange bug related only to settings with a requires condition. I found it accidentally while reading the code before some edit. (The original description was vague for me.)

    How to reproduce it:


    class ConfigTestRequires(TestCase):
        ....  # add this test method
        def test_conditional_items_regression(self):
            "issue #36: conditional vals in ConfigurationGroup.items()."
            c2 = config_get('req1', 'c2')
            self.assertNotEqual(dict(self.g1.items())['c3'], 77)
            self.assertEqual(dict(self.g1.items())['c2'], 77)

    I think that it was not a good idea to redefine values so that
    len(group.keys() != len(group.values())

    The first minimalistic fix without backward incompatibilities is this:


    class ConfigurationGroup(SortedDotDict):
        ....  # add this test method
        def items(self):
            return [(v.key, v) for v in self.values()]
  3. Log in to comment