~panosl/+junk/django-attachments

« back to all changes in this revision

Viewing changes to attachments/forms.py

  • Committer: Panos Laganakos
  • Date: 2011-10-08 08:02:24 UTC
  • Revision ID: panos@phaethon-designs.gr-20111008080224-qnsutn2c2nedhroj
handle exception if no file is selected for uploading.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
                raise forms.ValidationError(_('Filetype not allowed.'))
17
17
        except AttributeError:
18
18
            pass
19
 
        if settings.MAX_QUOTA and data._size > settings.MAX_QUOTA:
20
 
            raise forms.ValidationError(_('You are exceeding your allowed space.'))
 
19
        try:
 
20
            if settings.MAX_QUOTA and data._size > settings.MAX_QUOTA:
 
21
                raise forms.ValidationError(_('You are exceeding your allowed space.'))
 
22
        except AttributeError:
 
23
            pass
21
24
        return self.cleaned_data
22
25
            
23
26
    class Meta: