TireSwingSoftware/openassign-server — Issue #65: FIleDownload URL barfs if file doesn't exist
Author: mhrivnak
Created: 2012-01-07 01:14:07+00:00
State: open

If a FileDownload object exists but it's file hasn't been uploaded yet (can easily happen since the file processing happens asynchronously, and could also last a while if there is an error in that asynchronous process), the below error results when accessing the URL returned by FileDownloadManager().get_download_url_for_assignment().

Note that the trailing "None" seems to appear in the address bar after the response is received.

This situation should be handled more gracefully, by displaying a friendly error message rather than this cryptic "fail to match URL" type message.

```
Page not found (404)
Request Method:	GET
Request URL:	http://oadev.hrivnak.org/svc/file_tasks/download_file_for_assignment/a03eefb0936b4288ae04983a59941a05/1/None

Using the URLconf defined in urls, Django tried these URL patterns, in this order:

^$
^amf
^xmlrpc
^upload_progress$ [name='upload_progress']
^auth_token/(?P[A-Za-z0-9]+)/upload_csv/(?P[A-Za-z0-9]+)/$ [name='upload_csv_form']
^upload_csv
^export_csv
^confirm_email/(?P[A-Fa-f0-9]{40})/$ [name='confirm_email']
^upload_scorm_course
^auth_token/(?P[A-Za-z0-9]+)/upload/user/photo/user/id/(?P[0-9]+)/$ [name='upload_user_photo_form']
^upload/user/photo
^upload/organization/photo
^cookiecache/([A-Za-z0-9]+)/$
^scorm_player/(?P[A-Za-z0-9]+)/(?P\d+)/$ [name='scorm_player']
^scorm_player/lms_commit$ [name='lms_commit']
^scorm_player/db_post_form/(?P[A-Za-z0-9]+)/(?P\d+)/(?P.*)/$ [name='db_post_form']
^scorm_player/db_post_form/(?P[A-Za-z0-9]+)/(?P\d+)/$ [name='db_post_form']
^vod_aws/
^file_tasks/ ^upload_file_for_download/(?P[A-Za-z0-9]{32})/(?:(?P[0-9]+?)/)??$ [name='upload_file_for_download_form']
^file_tasks/ ^upload_file_for_download/$ [name='upload_file_for_download']
^file_tasks/ ^download_file_for_assignment/(?P[A-Za-z0-9]{32})/(?:(?P[0-9]+?)/)??$ [name='download_file_for_assignment']
^file_tasks/ ^upload_file_for_assignment/(?P[A-Za-z0-9]{32})/(?:(?P[0-9]+?)/)??$ [name='upload_file_for_assignment_form']
^file_tasks/ ^upload_file_for_assignment/$ [name='upload_file_for_assignment']
^~mhrivnak/media/(?P.*)$

The current URL, file_tasks/download_file_for_assignment/a03eefb0936b4288ae04983a59941a05/1/None, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
```