Commit fc72e749 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

fix: add __contains__ to dict_protocol_catcher to avoid breaking on "in"

Before this commit, doing:

    stuff = dict_protocol_catcher(entity)
    not_in_entity in stuff

Would break because since __contains__ doesn't exist, __getitem__ is called
instead and fails with a KeyError.
parent b823d5ee1752
Pipeline #8338 failed with stages
in 168 minutes and 1 second
......@@ -27,6 +27,8 @@ _MARKER = object()
class dict_protocol_catcher(object):
def __init__(self, entity):
self.__entity = entity
def __contains__(self, attr):
return attr in self.__entity.cw_edited
def __getitem__(self, attr):
return self.__entity.cw_edited[attr]
def __setitem__(self, attr, value):
......@@ -48,6 +48,7 @@ Fixed
- Use SchemaLoader instead of pyfilereader
- [pyramid-debugtoolbar] remove CW controller panel rendering when no controller got collected
- [basecontroller] link tags in the header can only be added on entities
- add a __contains__ method to dict_protocol_catcher to avoid breaking on "in"
Thanks to our contributors: Simon Chabot, Laurent Peuch, Nicolas Chauvat,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment