Opened 13 years ago
Last modified 12 years ago
#18418 closed Bug
Debug doesn't catch exception instead complains views does not exist — at Version 1
| Reported by: | yeukhon | Owned by: | nobody | 
|---|---|---|---|
| Component: | Core (URLs) | Version: | 1.4 | 
| Severity: | Normal | Keywords: | debug | 
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description (last modified by )
Suppose we have this forms.py:
class SubmitButtonField(forms.Field):
     # here we write a custom field....
class Editor(forms.Form):
    script_name = forms.CharField(max_length=60, min_length=1)
    view_level = forms.ChoiceField(widget=forms.widgets.RadioSelect, choices=VIEW_LEVEL)
    text_box = forms.CharField(widget=forms.widgets.Textarea, required=False)
    save_button = forms.SubmitButtonField(required=False)
    # notice save_button above....
Notice that save_button has an error. I accidentally added forms. in the beginning. This is invalid, and Python will raise exception.
However, when we try to visit the page, it complains about myapp.views.view_name does not exist.
I fired up django shell, and when I import myapp.views I got this error:
AttributeError: 'module' object has no attribute 'SubmitButtonField'
Django debug page does not really catch this kind of exception. Is this a bug or an enactment-to-be-made? 
  Note:
 See   TracTickets
 for help on using tickets.
    
Replaced the link to a paste site with the actual content, in case the paste site disappears.