Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 7.3.2 #289

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ Suggestions and bug reporting:
- Коптев Роман Викторович (romikforest)
- lei wang (191801737)
- d00m514y3r
- Sébastien Weber (seb5g)
- Ward Loos (wrdls)
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

Version 7.3.2
-------------

* Fixing #288 default get value error when using box_dots (thanks to Sébastien Weber)

Version 7.3.1
-------------

Expand Down
2 changes: 1 addition & 1 deletion box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

__author__ = "Chris Griffith"
__version__ = "7.3.1"
__version__ = "7.3.2"

from box.box import Box
from box.box_list import BoxList
Expand Down
6 changes: 3 additions & 3 deletions box/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ def __contains__(self, item):
except BoxError:
return False
else:
if not super().__contains__(first_item):
return False
it = self[first_item]
return isinstance(it, Iterable) and children in it

Expand Down Expand Up @@ -657,9 +659,7 @@ def __setitem__(self, key, value):
return self[first_item].__setitem__(children, value)
elif self._box_config["default_box"]:
if children[0] == "[":
super().__setitem__(
first_item, box.BoxList(**self.__box_config(extra_namespace=first_item))
)
super().__setitem__(first_item, box.BoxList(**self.__box_config(extra_namespace=first_item)))
else:
super().__setitem__(
first_item, self._box_config["box_class"](**self.__box_config(extra_namespace=first_item))
Expand Down
1 change: 1 addition & 0 deletions test/test_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ def test_get(self):
assert isinstance(bx.get("a", [1, 2]), BoxList)
bx_dot = Box(a=Box(b=Box(c="me!")), box_dots=True)
assert bx_dot.get("a.b.c") == "me!"
assert bx_dot.get("def.not.in.the.box", 4) == 4

def test_contains(self):
bx_dot = Box(a=Box(b=Box(c=Box())), box_dots=True)
Expand Down
Loading