Investigating https://code.djangoproject.com/ticket/21163
I came across these lines in mysql/base.py:
if settings.DEBUG:
warnings.filterwarnings("error", category=Database.Warning)
Finding out why, this bubbles up to somewhere in 2007
https://github.com/django/django/commit/f9c4ce51235aac4862cfe2dfaaf6836acaea1c3d
I can't find the reason why this behaviour is in, other than the comments
in de commit mentioned before: "Since the point is to raise Warnings as
exception"..
No arguments here.. Is there someone who actually knows the reasons?
It seems this code comes from the old MySQL days (pre 5/5.1) and a lot has
changed since in MySQL since then.
However.. I think in DEBUG mode these warning should be shown as warnings
as they are warnings :-) an not being promoted to Exceptions.
Maybe even _every_ warning should be shown and not only the first one. The
example in the bug-report is about data-truncation.
It's not something like a deprecation warning.
Coming to a conclusion _IMHO_ the different behaviour between debug mode or
not is somehow strange.
The behaviour should be either promote warning to exceptions in DEBUG=False
(production) too, but that probably breaks a lot of django implementations.
or, get the promotion out.
Any suggestions/ideas on this?
PS.
With these lines removed, none of the unittests fail.
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/b70cd133-f958-4f52-bd02-9dfb87582247%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.