Undo writes to metadata that should contain HTTP.
@@ -38,15 +38,11 @@ logger = logging.getLogger(__name__)
# Mixins
class ResourceToListItemMixin(object):
def resourceToResourceListItem(self, r):
- # site_url = hydroshare.utils.current_site_url()
- # bag_url = site_url + r.bag_url
- bag_url = r.bag_url
- # science_metadata_url = site_url + reverse('get_update_science_metadata', args=[r.short_id])
- science_metadata_url = reverse('get_update_science_metadata', args=[r.short_id])
- # resource_map_url = site_url + reverse('get_resource_map', args=[r.short_id])
- resource_map_url = reverse('get_resource_map', args=[r.short_id])
- # resource_url = site_url + r.get_absolute_url()
- resource_url = r.get_absolute_url()
+ site_url = hydroshare.utils.current_site_url()
+ bag_url = site_url + r.bag_url
+ science_metadata_url = site_url + reverse('get_update_science_metadata', args=[r.short_id])
+ resource_map_url = site_url + reverse('get_resource_map', args=[r.short_id])
+ resource_url = site_url + r.get_absolute_url()
coverages = [{"type": v['type'], "value": json.loads(v['_value'])}
for v in r.metadata.coverages.values()]
doi = None
@@ -75,9 +71,8 @@ class ResourceToListItemMixin(object):
class ResourceFileToListItemMixin(object):
def resourceFileToListItem(self, f):
- # site_url = hydroshare.utils.current_site_url()
- # url = site_url + f.url
- url = f.url
+ site_url = hydroshare.utils.current_site_url()
+ url = site_url + f.url
fsize = f.size
id = f.id
# trailing slash confuses mime guesser
@@ -283,7 +278,6 @@ class ResourceReadUpdateDelete(ResourceToListItemMixin, generics.RetrieveUpdateD
"""
res, _, _ = view_utils.authorize(request, pk,
needed_permission=ACTION_TO_AUTHORIZE.VIEW_RESOURCE)
- # site_url = hydroshare.utils.current_site_url()
if res.resource_type.lower() == "reftimeseriesresource":
# if res is RefTimeSeriesResource
@@ -691,7 +685,6 @@ class ScienceMetadataRetrieveUpdate(APIView):
def get(self, request, pk):
view_utils.authorize(request, pk, needed_permission=ACTION_TO_AUTHORIZE.VIEW_METADATA)
- # scimeta_url = hydroshare.utils.current_site_url() + AbstractResource.scimeta_url(pk)
scimeta_url = AbstractResource.scimeta_url(pk)
return redirect(scimeta_url)
@@ -792,7 +785,6 @@ class ResourceMapRetrieve(APIView):
def get(self, request, pk):
view_utils.authorize(request, pk, needed_permission=ACTION_TO_AUTHORIZE.VIEW_METADATA)
- # resmap_url = hydroshare.utils.current_site_url() + AbstractResource.resmap_url(pk)
resmap_url = AbstractResource.resmap_url(pk)
return redirect(resmap_url)
