Browse Source

Add hack to suppress warnings from crispy_forms

Temporary. Should be reverted as soon as crispy_forms get corrected!
pull/6/head
Marcio Mazza 10 years ago
parent
commit
7be15ffe49
  1. 7
      sapl/settings.py
  2. 22
      sapl/temp_suppress_crispy_form_warnings.py

7
sapl/settings.py

@ -11,6 +11,9 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from unipath import Path
from .temp_suppress_crispy_form_warnings import \
SUPRESS_CRISPY_FORM_WARNINGS_LOGGING
BASE_DIR = Path(__file__).ancestor(2)
@ -142,3 +145,7 @@ BOWER_INSTALLED_APPS = (
'components-font-awesome',
'foundation-icon-fonts',
)
# hack to suppress many annoying warnings from crispy_forms
# see sapl.temp_suppress_crispy_form_warnings
LOGGING = SUPRESS_CRISPY_FORM_WARNINGS_LOGGING

22
sapl/temp_suppress_crispy_form_warnings.py

@ -0,0 +1,22 @@
import copy
import logging
from django.utils.log import DEFAULT_LOGGING
# hack to suppress many annoying warnings from crispy_forms
# Do remove this file and corresponding import in settings
# when crispy_forms is corrected !!!
SUPRESS_CRISPY_FORM_WARNINGS_LOGGING = copy.deepcopy(DEFAULT_LOGGING)
SUPRESS_CRISPY_FORM_WARNINGS_LOGGING['filters']['suppress_deprecated'] = {
'()': 'sapl.temp_suppress_crispy_form_warnings.SuppressDeprecated'
}
SUPRESS_CRISPY_FORM_WARNINGS_LOGGING['handlers']['console']['filters'].append(
'suppress_deprecated')
class SuppressDeprecated(logging.Filter):
def filter(self, record):
msg = record.getMessage()
return not ('crispy_forms' in msg
and 'RemovedInDjango19Warning' in msg)
Loading…
Cancel
Save