mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-05 07:08:11 +08:00
Fix AttributeError by storing ItemSource objects in default_item_source
Previously, default_item_source was set to a string ("s3" or "local"),
but matching_source() tried to access default_item_source.name, causing:
AttributeError: 'str' object has no attribute 'name'
This bug occurred when source_name=None (single data source configuration)
and has existed since the ItemSource interface was introduced in 2021.
Changes:
- Store the actual ItemSource object reference instead of string name
- Assign to intermediate variables (s3_source, file_source) for clarity
Fixes the error when viewing datasets with a single data source configured.
This commit is contained in:
@@ -98,15 +98,17 @@ def initialize_data_sources():
|
||||
if cellxgene_bucket is not None:
|
||||
from cellxgene_gateway.items.s3.s3item_source import S3ItemSource
|
||||
|
||||
item_sources.append(S3ItemSource(cellxgene_bucket, name="s3"))
|
||||
default_item_source = "s3"
|
||||
s3_source = S3ItemSource(cellxgene_bucket, name="s3")
|
||||
item_sources.append(s3_source)
|
||||
default_item_source = s3_source
|
||||
logger.info("Initialized S3 data source")
|
||||
logger.debug(f"S3 bucket: {cellxgene_bucket}")
|
||||
if cellxgene_data is not None:
|
||||
from cellxgene_gateway.items.file.fileitem_source import FileItemSource
|
||||
|
||||
item_sources.append(FileItemSource(cellxgene_data, name="local"))
|
||||
default_item_source = "local"
|
||||
file_source = FileItemSource(cellxgene_data, name="local")
|
||||
item_sources.append(file_source)
|
||||
default_item_source = file_source
|
||||
logger.info("Initialized local file data source")
|
||||
logger.debug(f"Data directory: {cellxgene_data}")
|
||||
if len(item_sources) == 0:
|
||||
|
||||
Reference in New Issue
Block a user