platformsh / config-reader-python

Configuration reader library for Platform.sh hosting - Python version.
MIT License
7 stars 5 forks source link

Be more permissive and helpful in the relationship check. #18

Closed Crell closed 5 years ago

NickAnderegg commented 5 years ago

This all likes fine to me, but it made me realize we never fixed the implementation of __getitem__(). If an object is missing a key, then it should raise a KeyError when __getitem__ is called. In contrast, we just have it returning None if the key is missing. The code will definitely function, but this is slightly non-standard behavior.

Realistically, how we want to implement it is have __getitem__ raise a KeyError, and then instead of a series of if statements, it should be a series of try..except blocks. Other than that implementation detail that's not directly related to this PR, the logic of this seems fine to me.