Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-12559

daf.persistance.Policy does not validate input

    Details

    • Templates:

      Description

      Although daf.persistance.Policy objects are not allowed to contain keys with dots, they can be constructed from policy files that contain them. The result is a corrupted Policy that reports the invalid key in names(), but treats the key as absent when using the in or [] operators.

      The bug can be reproduced using the attached file:

      >>> from lsst.daf.persistence import Policy
      >>> policy = Policy("bad_policy.yaml")
      >>> policy.names()
      ['goodKey', 'goodKey.complexKey', 'goodKey.bad.Key']
      >>> 'goodKey.bad.Key' in policy.names()
      True
      >>> 'goodKey.bad.Key' in policy
      False
      >>> policy['goodKey.bad.Key']
      

      Please add input validation to the initialization code so that attempts to create invalid policies raise an appropriate exception instead of silently breaking.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                krzys Krzysztof Findeisen
                Watchers:
                Krzysztof Findeisen
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Summary Panel