marksweb / django-bleach

Bleach is a Python module that takes any HTML input, and returns valid, sanitised HTML that contains only an allowed subset of HTML tags, attributes and styles. django-bleach is a Django app that makes using bleach extremely easy.
MIT License
148 stars 23 forks source link

Allows BleachField to be blank or null #9

Closed denisroldan closed 5 years ago

denisroldan commented 5 years ago

Feature description

BleachField now accepts nullable or blank values.

Tested on

Python 3.6+ Django==1.11.20 bleach==3.1.0

Bug cause

As happened on #6, due to bleach changes here clean didn't accept None values. That caused any model with a nullable BleachField to raise an exception like this one:

TypeError: argument cannot be of 'NoneType' type, must be of text type

codecov[bot] commented 5 years ago

Codecov Report

Merging #9 into master will increase coverage by 0.06%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   97.95%   98.01%   +0.06%     
==========================================
  Files           5        5              
  Lines          98      101       +3     
  Branches       17       18       +1     
==========================================
+ Hits           96       99       +3     
  Misses          2        2
Impacted Files Coverage Δ
django_bleach/models.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3944616...90cf839. Read the comment docs.

marksweb commented 5 years ago

Thanks @denisroldan