Catch error when listing staging files fails

This commit is contained in:
Roberto Rosario
2011-02-07 14:33:58 -04:00
parent a8bd7da2e2
commit be267c476c

View File

@@ -53,7 +53,11 @@ class DocumentForm_edit(DocumentForm):
class StagingDocumentForm(forms.Form):
def __init__(self, *args, **kwargs):
super(StagingDocumentForm, self).__init__(*args, **kwargs)
self.fields['staging_file_id'].choices=[(staging_file.id, staging_file) for staging_file in StagingFile.get_all()]
try:
self.fields['staging_file_id'].choices=[(staging_file.id, staging_file) for staging_file in StagingFile.get_all()]
except:
pass
if 'initial' in kwargs:
if 'document_type' in kwargs['initial']:
filenames_qs = kwargs['initial']['document_type'].documenttypefilename_set.filter(enabled=True)