ui / django-html_sanitizer Goto Github PK
View Code? Open in Web Editor NEWA set of HTML input sanitization or cleaning utilities for django models, forms and templates
License: MIT License
A set of HTML input sanitization or cleaning utilities for django models, forms and templates
License: MIT License
I've installed bleach and sanitizer, but I get ImportError: No module named sanitizer
when trying to add "sanitizer"
to INSTALLED_APPS
.
If strip=False
then escaping introduces extra characters than the given string which might lead to integrity constraint errors while saving to database. This is caused since when we have a 100 character column and we give 80 characters of HTML with strip as False then validation passes through but the escaping adds more characters that might cause the string length to be more than 100 characters while saving to database. The safe way will be to use strip=True
. I don't know how this can be handled in this layer but just wanted to give a heads up on this.
Thanks for the library.
Unsurprisingly this looks like its not compatible with Bleach 5.0.0 due to that styles kwarg change. We've had the the older version of bleach pinned for a while but would it be possible update this library to support Bleach 5.0.0? I can create a PR with the change if needed (seems fairly straightforward?)
If I install django_sanitizer as python egg via buildout, line bellow fails:
from sanitizer.models import SanitizedTextField
But if I simply clone http-readonly repository, import statement works fine.
Looks like something is wrong with the package configuration.
In order to adapt to the API changes in the current html5lib release, bleach is making substantial changes of its own:
https://github.com/mozilla/bleach
It does not appear to me that django-html_sanitizer is compatible with the bleach changes. If I run test.py in python2.7 with the new bleach I get:
python tests.py
Traceback (most recent call last):
File "tests.py", line 6, in
from sanitizer.templatetags.sanitizer import (sanitize, sanitize_allow,
ImportError: No module named templatetags.sanitizer
The new bleach is expected to be released next week.
The python package isnt updated to include the smart_unicode fix which is causing errors
django 1.11 using sanitizer for varchar field. in case if user put any type of string to <> it will automatically add </> after save operation.
Hi, I get import error:
ile "/lib/python3.4/site-packages/sanitizer/models.py", line 3, in
from django.utils.encoding import smart_unicode
ImportError: cannot import name 'smart_unicode'
After replace in your models.py 'smart_unicode' to 'smart_text as smart_unicode' the error is gone.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.