diff --git a/mibios/glamr/tables.py b/mibios/glamr/tables.py
index a03f991..5f3914a 100644
--- a/mibios/glamr/tables.py
+++ b/mibios/glamr/tables.py
@@ -294,6 +294,7 @@ def order_storage_size(self, qs, is_descending):
class FileTable(OmicsFileTable):
+ """ List files belonging to a sample """
class Meta:
model = omics_models.File
fields = ['download_url', 'filetype', 'size', 'modtime']
diff --git a/mibios/omics/models.py b/mibios/omics/models.py
index cda6504..27f1132 100644
--- a/mibios/omics/models.py
+++ b/mibios/omics/models.py
@@ -1033,7 +1033,12 @@ def public_root(self):
@property
def relpath(self):
""" The path relative to the common path prefix """
- return self.path.relative_to(self.root)
+ if self.root:
+ return self.path.relative_to(self.root)
+ elif self.path.is_absolute():
+ raise ValueError('path is absolute abnd no root configured')
+ else:
+ return self.path
@property
def relpublic(self):
@@ -1042,12 +1047,15 @@ def relpublic(self):
This property may be exposed on a public page.
- Returns None if no public path is set or if the common prefix is not
- configured.
+ Returns None if no public path is set.
"""
- if self.public_root is None or self.public is None:
- return None
- return self.public.relative_to(self.public_root)
+ if self.public_root:
+ return self.public.relative_to(self.public_root)
+ elif self.public and self.public.is_absolute():
+ raise ValueError('public path is absolute and no root configured')
+ else:
+ # is a rel path or None
+ return self.public
def compute_public_path(self):
"""
diff --git a/mibios/omics/settings.py b/mibios/omics/settings.py
index c71d04d..cc374ac 100644
--- a/mibios/omics/settings.py
+++ b/mibios/omics/settings.py
@@ -62,9 +62,8 @@ def get_db_settings(db_dir='.', db_infix=''):
""" root Globus url for file app, publicly shared directory """
PUBLIC_DATA_ROOT = None
-""" path to publicly accessible directory on staging server, this needs to be
-set even on other deployments so that relative paths to the public files can be
-computed """
+""" path to root of publicly accessible directory tree on staging server, leave
+at None on other deployments """
OMICS_CHECKOUT_FILE = None
""" path to the file checkout listing """
diff --git a/mibios/omics/tables.py b/mibios/omics/tables.py
index 3ee5ba2..c8bcc6c 100644
--- a/mibios/omics/tables.py
+++ b/mibios/omics/tables.py
@@ -30,14 +30,14 @@ class Meta:
def render_download_url(self, value, record):
if record.public:
- path = record.public.relative_to(File.get_public_prefix())
- if value:
- return format_html('{}', value, path)
- else:
- return f'{path} (unavailable)'
+ path = record.relpublic
else:
- path = record.path.relative_to(File.get_path_prefix())
- return str(path)
+ path = record.relpath
+
+ if value:
+ return format_html('{}', value, path)
+ else:
+ return f'{"" if record.public else "*"}{path}'
def order_download_url(self, queryset, is_descending):
qs = queryset.annotate(path0=Coalesce('public', 'path'))