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

Data sources on new client #830

Merged
merged 4 commits into from
Dec 17, 2024
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Write the date in place of the "Unreleased" in the case a new version is release

- `docker-compose.yml` now uses the healthcheck endpoint `/healthz`

### Fixed

- Bug in Python client resulted in error when accessing data sources on a
just-created object.

## 2024-12-09

### Added
Expand Down
7 changes: 6 additions & 1 deletion tiled/_tests/test_asset_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ def client(context):

def test_include_data_sources_method_on_self(client):
"Calling include_data_sources() fetches data sources on self."
client.write_array([1, 2, 3], key="x")
x = client.write_array([1, 2, 3], key="x")
# Fetch data_sources on x object directly.
with pytest.warns(UserWarning):
# This fetches the sources with an additional implicit request.
x.data_sources()
# Fetch data_sources on x object, looked up in client.
with pytest.warns(UserWarning):
# This fetches the sources with an additional implicit request.
client["x"].data_sources()
Expand Down
4 changes: 4 additions & 0 deletions tiled/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def new_variation(
self,
structure_clients=UNCHANGED,
include_data_sources=UNCHANGED,
structure=UNCHANGED,
**kwargs,
):
"""
Expand All @@ -282,9 +283,12 @@ def new_variation(
structure_clients = self.structure_clients
if include_data_sources is UNCHANGED:
include_data_sources = self._include_data_sources
if structure is UNCHANGED:
structure = self._structure
return type(self)(
self.context,
item=self._item,
structure=structure,
structure_clients=structure_clients,
include_data_sources=include_data_sources,
**kwargs,
Expand Down
Loading