Skip to content

Commit

Permalink
Merge pull request #830 from danielballan/data-sources-on-new-client
Browse files Browse the repository at this point in the history
Data sources on new client
  • Loading branch information
genematx authored Dec 17, 2024
2 parents 9f8e11a + 5b449c1 commit e19d276
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
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

0 comments on commit e19d276

Please sign in to comment.