Re: [mezzanine-users] Error saving Blog Posts and Pages with rich text fields

309 views
Skip to first unread message

Josh Cartmell

unread,
May 17, 2013, 5:48:51 PM5/17/13
to mezzani...@googlegroups.com
I just ran into this same issue myself, it turns out that html5lib, which the bleach library relies, on removed something which the bleach library used.  An easy fix for now is to install an older version of html5lib, bleach requires at lesat 0.95 so pip install html5lib==0.95 should fix the problem.  Another option, although I don't necessarily recommend this, is to set the richtext filter level to none in Site -> Settings

It is worth noting that this will happen to any new installations of mezzanine that use pip/easy_install.


On Fri, May 17, 2013 at 2:41 PM, Michael Godshall <michael...@gmail.com> wrote:
I'm deploying Mezzanine on heroku, but I'm running into the following error when I try to save objects with rich text fields, like blog posts and pages.  It seems to be related to bleach and html5lib.  I don't have any errors when I run it locally.  Any ideas how I can resolve this?  Thanks in advance.

Exception Type: TypeError at /admin/blog/blogpost/add/
Exception Value: 'NoneType' object is not callable

Environment:

Request Method: POST

Django Version: 1.5.1
Python Version: 2.7.4
Installed Applications:
['mezzanine.boot',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.redirects',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'mezzanine.conf',
 'mezzanine.core',
 'mezzanine.generic',
 'mezzanine.blog',
 'mezzanine.forms',
 'mezzanine.pages',
 'mezzanine.galleries',
 'mezzanine.twitter',
 'gunicorn',
 'storages',
 'compressor',
 'filebrowser_safe',
 'south',
 'grappelli_safe',
 'django.contrib.admin',
 'django.contrib.comments']
Installed Middleware:
('mezzanine.core.middleware.UpdateCacheMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'mezzanine.core.request.CurrentRequestMiddleware',
 'mezzanine.core.middleware.RedirectFallbackMiddleware',
 'mezzanine.core.middleware.TemplateForDeviceMiddleware',
 'mezzanine.core.middleware.TemplateForHostMiddleware',
 'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware',
 'mezzanine.core.middleware.SitePermissionMiddleware',
 'mezzanine.pages.middleware.PageMiddleware',
 'mezzanine.core.middleware.FetchFromCacheMiddleware')


Traceback:
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  372.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  202.             return view(request, *args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/transaction.py" in inner
  223.                 return func(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/options.py" in add_view
  989.             if form.is_valid():
File "/app/.heroku/python/lib/python2.7/site-packages/django/forms/forms.py" in is_valid
  126.         return self.is_bound and not bool(self.errors)
File "/app/.heroku/python/lib/python2.7/site-packages/django/forms/forms.py" in _get_errors
  117.             self.full_clean()
File "/app/.heroku/python/lib/python2.7/site-packages/django/forms/forms.py" in full_clean
  274.         self._post_clean()
File "/app/.heroku/python/lib/python2.7/site-packages/django/forms/models.py" in _post_clean
  332.             self.instance.clean_fields(exclude=exclude)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py" in clean_fields
  946.                 setattr(self, f.attname, f.clean(raw_value, self))
File "/app/.heroku/python/lib/python2.7/site-packages/mezzanine/core/fields.py" in clean
  66.                          strip_comments=False, styles=styles)
File "/app/.heroku/python/lib/python2.7/site-packages/bleach/__init__.py" in clean
  111.     return _render(parser.parseFragment(text))
File "/app/.heroku/python/lib/python2.7/site-packages/bleach/__init__.py" in _render
  306.         return force_unicode(_serialize(tree))
File "/app/.heroku/python/lib/python2.7/site-packages/bleach/__init__.py" in _serialize
  313.     stream = walker(domtree)

Exception Type: TypeError at /admin/blog/blogpost/add/
Exception Value: 'NoneType' object is not callable

--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Josh Cartmell

unread,
May 17, 2013, 5:51:21 PM5/17/13
to mezzani...@googlegroups.com
Oh yeah, for anyone who is interested, here is an issue on the bleach github about it, https://github.com/jsocol/bleach/issues/94

Josh Cartmell

unread,
May 17, 2013, 6:01:10 PM5/17/13
to mezzani...@googlegroups.com
Hey Steve I just saw your comment on that github issue.  I'm not sure if this would work but could you add a requirement of html5lib==0.95 to Mezzanine's setup.py after the bleach requirement that way the proper version would be forced to be installed.  Then, at least in the short term Mezzanine installs could keep moving without incident.

Stephen McDonald

unread,
May 17, 2013, 6:03:56 PM5/17/13
to mezzani...@googlegroups.com
Yep I was planning a release over the next day or so, I might just fast track that now and include the pin.

Thanks Josh.
--
Stephen McDonald
http://jupo.org

Josh Cartmell

unread,
May 17, 2013, 6:08:08 PM5/17/13
to mezzani...@googlegroups.com
No problem, thanks for you vigilance!

Stephen McDonald

unread,
May 17, 2013, 7:31:59 PM5/17/13
to mezzani...@googlegroups.com

Michael Godshall

unread,
May 18, 2013, 10:26:48 AM5/18/13
to mezzani...@googlegroups.com, st...@jupo.org
Thanks Josh and Stephen!  Setting html5lib==0.95 worked, as well as upgrading to Mezzanine 1.4.7.  I greatly appreciate the help.
Reply all
Reply to author
Forward
0 new messages