Skip to content

Commit

Permalink
Don't use a default for yaml config files unless appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Oct 15, 2024
1 parent 21a527f commit 4e58f07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 1.30.1

### Bug Fixes

- Don't use a default for yaml config files except .large_image_config.yaml ([#1685](../../pull/1685))

## 1.30.0

### Features
Expand Down
7 changes: 5 additions & 2 deletions girder/girder_large_image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,17 @@ def adjustConfigForUser(config, user):
return config


def addSettingsToConfig(config, user):
def addSettingsToConfig(config, user, name=None):
"""
Add the settings for showing thumbnails and images in item lists to a
config file if the itemList or itemListDialog options are not set.
:param config: the config dictionary to modify.
:param user: the current user.
:param name: the name of the config file.
"""
if name and name != '.large_image_config.yaml':
return
columns = []

showThumbnails = Setting().get(constants.PluginSettings.LARGE_IMAGE_SHOW_THUMBNAILS)
Expand Down Expand Up @@ -596,7 +599,7 @@ def yamlConfigFile(folder, name, user):
folder = Folder().load(folder['parentId'], user=user, level=AccessType.READ)

addConfig = {} if addConfig is None else addConfig
addSettingsToConfig(addConfig, user)
addSettingsToConfig(addConfig, user, name)
return addConfig


Expand Down
8 changes: 7 additions & 1 deletion girder/test_girder/test_large_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,17 @@ def testYAMLConfigFile(server, admin, user, fsAssetstore):
colFolderA, 'folder B', creator=admin)
groupA = Group().createGroup('Group A', admin)

resp = server.request(
path='/folder/%s/yaml_config/.large_image_config.yaml' % str(colFolderB['_id']),
method='GET')
assert utilities.respStatus(resp) == 200
assert resp.json.get('itemList') is not None

resp = server.request(
path='/folder/%s/yaml_config/sample.json' % str(colFolderB['_id']),
method='GET')
assert utilities.respStatus(resp) == 200
assert resp.json['itemList'] is not None
assert resp.json.get('itemList') is None

colFolderConfig = Folder().createFolder(
collection, '.config', parentType='collection',
Expand Down

0 comments on commit 4e58f07

Please sign in to comment.