PSU-CSAR / django-ebagis

Django app for the eBAGIS web platform.
1 stars 0 forks source link

Error when going to download requests #68

Open jkeifer opened 7 years ago

jkeifer commented 7 years ago

Here is the traceback. I think it is because I didn't have any downloads.

AttributeError at /accounts/downloads/
'NoneType' object has no attribute 'name'
Request Method: GET
Request URL:    https://test.ebagis.geog.pdx.edu/accounts/downloads/
Django Version: 1.11.3
Exception Type: AttributeError
Exception Value:    
'NoneType' object has no attribute 'name'
Exception Location: D:\projects\ebagis\testing\ebagis_beta\django-ebagis\ebagis\models\download.py in filename, line 44
Python Executable:  C:\Anaconda_x86\envs\ebagis_beta\python.exe
Python Version: 2.7.13
Python Path:    
['D:\\projects\\ebagis\\testing\\ebagis_beta\\django-ebagis',
 'D:\\projects\\ebagis\\testing\\ebagis_beta\\django-ebagis',
 u'c:\\program files (x86)\\arcgis\\desktop10.3\\arcpy',
 'D:\\projects\\ebagis\\testing\\ebagis_beta\\django-ebagis',
 'C:\\Anaconda_x86\\envs\\ebagis_beta\\python27.zip',
 'C:\\Anaconda_x86\\envs\\ebagis_beta\\DLLs',
 'C:\\Anaconda_x86\\envs\\ebagis_beta\\lib',
 'C:\\Anaconda_x86\\envs\\ebagis_beta\\lib\\plat-win',
 'C:\\Anaconda_x86\\envs\\ebagis_beta\\lib\\lib-tk',
 'C:\\Anaconda_x86\\envs\\ebagis_beta',
 'C:\\Anaconda_x86\\envs\\ebagis_beta\\lib\\site-packages',
 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.3\\bin',
 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.3\\ArcPy',
 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.3\\ArcToolBox\\Scripts',
 'd:\\projects\\ebagis\\testing\\ebagis_beta\\django-ebagis',
 'C:\\Anaconda_x86\\envs\\ebagis_beta']
Server time:    Mon, 28 Aug 2017 17:41:06 -0700
jkeifer commented 7 years ago

Actually, this is because an AOI I uploaded had been deleted. The correct solution here is to do two things:

  1. Don't actually delete anything when something is "deleted". The removed_at timestamp should be set and there should be a method on every model checking whether an object is valid, i.e., not removed. We can then filter everything all the time based on that method.

  2. We need a cleanup process to run periodically to remove all deleted filesystem objects. In other words, if an AOI was deleted 30 days ago, the process should see that has been in a removed state for a sufficient amount of time to be cleaned up, and then it will delete all files referenced by paths in the AOI and its data records. The paths will also be set to '', indicating they have been cleaned up.