Changes between Version 53 and Version 54 of BetterErrorMessages


Ignore:
Timestamp:
02/24/2014 02:40:53 PM (18 months ago)
Author:
anubhav9042
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BetterErrorMessages

    v53 v54  
    1313
    1414
    15 == django.contrib.admin ==
     15== django.contrub.auth ==
    1616
     17If you try to create a model with a table name > 50 characters (and you've enabled django.contrib.auth) then you get a very poor error message when running syncdb.
    1718{{{
    18 'NoneType' object has no attribute 'get_field_sets'
     19env src/tmp/qdel$ python ./manage.py syncdb
     20Creating tables ...
     21Traceback (most recent call last):
     22...
     23...
     24django.db.utils.DatabaseError: value too long for type character varying(50)
    1925}}}
    20 '''Context:''' One or more models that are referenced by !ForeignKey from another model are missing their inner `Admin` class. Possible other causes as well. See ticket #1808. [[BR]]
    21 '''Suggestion:''' Check relevant Admin settings during model validation?
    22 
    23  * Ticket #3219 -- suggestion for better error messages for invalid Admin attributes
    24 
    25 {{{
    26 Please correct the error below.
    27 }}}
    28 '''Context:''' This error may appear on the admin screen after trying to save a form, even though there is no error below that is highlighted. [[BR]]
    29 '''Suggestion:''' Check to see if you have listed the desired fields in !ModelAdmin, but then misspelled one while trying to use a custom form field in an associated !ModelForm.
     26'''Suggestion:''' Look for DatabaseError in contrib/auth/management/init.py.
     27Related #18959
    3028
    3129== django.core ==
    3230
    33 {{{
    34 TypeError at ...
    35 string indices must be integers
    36 }}}
    37 '''Context:''' A !FileUploadField is being validated but the form did not have enctype="multipart/form-data" set.[[BR]]
    38 '''Suggestion''': Check form enctype during validation? Show FILES in addition to GET and POST on error pages?
     31 The 404 error page served when django.core.urlresolvers.resolve() fails does not contain the exception stack trace, which makes finding the failing call unnecessarily difficult.
    3932
    40  * Ticket #3221 -- patch for better error message for faulty URLconf
     33 * Ticket #22055 -- 404 page does not display stack trace when Resolver404 is raised from a view.
     34 * Ticket #21668 -- Invalid upload_to FileField attribute results in hard-to-debug "Bad Request" 400 error.
     35 * Ticket #22058 -- Add `Http405` exception class and `handler405` view (simillar to 404, 403 and 500).
    4136
    42 {{{
    43   File "c:\django\django\core\urlresolvers.py", line 255, in _get_urlconf_module
    44     raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e)
    45 
    46 ImproperlyConfigured: Error while importing URLconf 'reports.urls': tuple index out of range
    47 }}}
    48 '''Context:''' A Trying to load my home page and it is evidently finding something wrong with my urls.py[[BR]]
    49 '''Suggestion''': Output which tuple it is trying to index, and perhaps even the entire 'patterns'
    50 
    51  * Ticket #6537 -- Unhelpful error message: 'tuple index out of range'
    52 
    53 {{{
    54 Error: cannot import name FooBar
    55 }}}
    56 '''Context:''' You get only this error line starting the developer server. But this doesn't help to find the real error.[[BR]]
    57 '''Suggestion:''' e.g. one model can't import because you have a import loop. Use the patch from Ticket #11667 to get a full traceback and bugfix your models.
    58 
    59  * Ticket #11667 -- Full traceback if import error before model validation
    60 
    61 == django.core.servers ==
    62 
    63 {{{
    64 AttributeError: WSGIRequestHandler instance has no attribute 'path'
    65 }}}
    66 '''Context:''' This error gets raised when a server started by runserver is (by accident) accessed via `https://`. [http://thinkhole.org/wp/2007/03/01/django-wsgirequesthandler-error/ Details here].[[BR]]
    67 '''Suggestion:''' runserver does not support https, please use it only via http.
     37== django.core.urlresolver ==
     38Better error message when can't import url callback. Related #8809.
    6839
    6940== django.db ==
     
    12091Unfortunately we can't automatically fix it, because if the field is left blank, the developer might be intending to supply the value automatically before save (https://code.djangoproject.com/ticket/13824).
    12192
     93Here are some tickets that must be paid attention to:
     94* Raise explicit error when unpickling QuerySet from incompatible version. #21430
     95* Assigning unsaved model to a ForeignKey leads to silent failures. #10811
     96* #20752
     97* #7074
     98
    12299== django.forms ==
    123100
    124101{{{
    125 AttributeError: 'NoneType' object has no attribute 'widget'
     102ValidationError: 'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.'
    126103}}}
    127 (in BaseForm.full_clean)
     104If the error message contained the invalid data, and, especially the name of the field that was being validated, that would be way more helpful.
    128105
    129 A ModelForm refers to a nonexistent field.
     106Integrity Error is raised when trying to edit a model that has some unique_together fields and is
     107registered with list_editable containing some of that fields.
     108Related Ticket #13091.
    130109
    131 If you create a ModelForm but neglect to indicate the model in the Meta, you get:
    132 {{{
    133 TypeError: 'NoneType' object is not callable
    134 }}}
    135 In django.forms.models line 240 there could be a check to make sure the options instance has a valid model declaration and if not warn the user more explicitly ("ModelForm <classname> does is missing the model")
    136 This is covered by #12285.
    137 
    138 
    139 #15126 describes a common class of problem -- users with a single-item tuple forgetting the trailing comma. This was reported in the context of ModelForm.fields, but is a general problem that can (and should) be caught and reported.
     110Ticket #15069 -- ValidationError message isn't helpful in tracking down the field that fails validation.
    140111
    141112== django.http ==
     
    152123== django.template ==
    153124
    154  * See [http://groups.google.com/group/django-developers/browse_thread/thread/42aff5c291a69041/d006eb5292b8aac3 this thread on the django-developers list] for discussion of suppression of TypeError in the template engine
     125 * See [http://groups.google.com/group/django-developers/browse_thread/thread/42aff5c291a69041/d006eb5292b8aac3 this thread on the django-developers list] for discussion of suppression of TypeError in the template engine.
     126
     127 When resolving a template variable that calls an object method/property. If that method/property has errors we get a {{{VariableDoesNotExist}}} exception without what errors happened, which might confuse the user.
     128 See #16383 for more details.
     129
     130 Looking at these might be useful: #6907 and #11421.
    155131
    156132== django.template.!__init!__.py ==
     
    172148}}}
    173149What seems to be happening is that self.invalid_block_tag(...) raises an error which gets caught by !TemplateSyntaxError and which eventually leads to the generic 'list index out of range' error being reported in the Django error page.
    174 
    175 == FIXED ==
    176 
    177  * Ticket #1732 -- a problem that elicits no error message, but should.
    178  * Ticket #16770 -- Any error that occurred during template rendering was previously wrapped by TemplateSyntaxError.
Back to Top