Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html5lib issue causing AttributeError #328

Closed
afs2015 opened this issue Jun 1, 2018 · 8 comments
Closed

html5lib issue causing AttributeError #328

afs2015 opened this issue Jun 1, 2018 · 8 comments

Comments

@afs2015
Copy link

afs2015 commented Jun 1, 2018

After following the django cms installation tutorial I got an attribute error when attempting to make my first page after hitting the green "Create" button.

I was able to fix it by running pip uninstall html5lib and then pip install html5lib which put html5lib 1.0.1 which appears to work. I believe the issue is with the current version of html5lib djangocms-installer requires and more details can be found here: django-cms/django-cms#6401

@yakky
Copy link
Member

yakky commented Jun 2, 2018

This should have been fixed by #327 (by pinning djangocms-text ckeditor)
We should be able to make a patch release by this weekend

@yakky
Copy link
Member

yakky commented Jun 3, 2018

1.0.1 with the #327 has been released
thanks for the heads up

@yakky yakky closed this as completed Jun 3, 2018
@afs2015
Copy link
Author

afs2015 commented Jun 3, 2018

Thanks for fixing this!

@yakky
Copy link
Member

yakky commented Jun 4, 2018

@afs2015 thanks for the update!

@m-aciek
Copy link

m-aciek commented Nov 16, 2018

Actually I still experience this problem with djangocms-installer 1.0.1.

I have djangocms-installer 1.0.1 installed with pipenv.
maciek@radagast:~/Projects/martacms$ pipenv install djangocms-installer
Creating a virtualenv for this project...
Pipfile: /home/maciek/Projects/martacms/Pipfile
Using /usr/bin/python3.6 (3.6.6) to create virtualenv...
⠋Already using interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/bin/python3.6
Also creating executable in /home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/bin/python
Installing setuptools, pip, wheel...done.
Setting project for martacms-9RJn6Jj_ to /home/maciek/Projects/martacms

Virtualenv location: /home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_
Creating a Pipfile for this project...
Installing djangocms-installer...
Collecting djangocms-installer
Downloading https://files.pythonhosted.org/packages/8c/1b/de34b89269a73ea655b2e243e7367cf9409bef263387b78d3999f111d44c/djangocms_installer-1.0.1-py2.py3-none-any.whl (59kB)
Collecting six (from djangocms-installer)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting argparse (from djangocms-installer)
Downloading https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl
Requirement already satisfied: pip in /home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages (from djangocms-installer) (18.1)
Collecting dj-database-url>=0.4 (from djangocms-installer)
Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
Collecting tzlocal (from djangocms-installer)
Downloading https://files.pythonhosted.org/packages/cb/89/e3687d3ed99bc882793f82634e9824e62499fdfdc4b1ae39e211c5b05017/tzlocal-1.5.1.tar.gz
Collecting pytz (from tzlocal->djangocms-installer)
Downloading https://files.pythonhosted.org/packages/f8/0e/2365ddc010afb3d79147f1dd544e5ee24bf4ece58ab99b16fbb465ce6dc0/pytz-2018.7-py2.py3-none-any.whl (506kB)
Building wheels for collected packages: tzlocal
Running setup.py bdist_wheel for tzlocal: started
Running setup.py bdist_wheel for tzlocal: finished with status 'done'
Stored in directory: /home/maciek/.cache/pipenv/wheels/15/ae/df/a67bf1ed84e9bf230187d36d8dcfd30072bea0236cb059ed91
Successfully built tzlocal
Installing collected packages: six, argparse, dj-database-url, pytz, tzlocal, djangocms-installer
Successfully installed argparse-1.4.0 dj-database-url-0.5.0 djangocms-installer-1.0.1 pytz-2018.7 six-1.11.0 tzlocal-1.5.1

Adding djangocms-installer to Pipfile's [packages]...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...

I run djangocms newproject following the tutorial. (There is a warning about not fulfilled requirement.)
(martacms-9RJn6Jj_) maciek@radagast:~/Projects/martacms$ djangocms -f -p . strona -s
Creating the project
Please wait while I install dependencies
If I am stuck for a long time, please check for connectivity / PyPi issues
djangocms-text-ckeditor 3.6.1 has requirement html5lib>=0.999999999, but you'll have html5lib 0.9999999 which is incompatible.
Dependencies installed
Creating the project
Operations to perform:
  Apply all migrations: admin, auth, cms, contenttypes, djangocms_column, djangocms_file, djangocms_googlemap, djangocms_link, djangocms_picture, djangocms_snippet, djangocms_style, djangocms_text_ckeditor, djangocms_video, easy_thumbnails, filer, menus, sessions, sites
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying sites.0001_initial... OK
  Applying cms.0001_initial... OK
  Applying cms.0002_auto_20140816_1918... OK
  Applying cms.0003_auto_20140926_2347... OK
  Applying cms.0004_auto_20140924_1038... OK
  Applying cms.0005_auto_20140924_1039... OK
  Applying cms.0006_auto_20140924_1110... OK
  Applying cms.0007_auto_20141028_1559... OK
  Applying cms.0008_auto_20150208_2149... OK
  Applying cms.0008_auto_20150121_0059... OK
  Applying cms.0009_merge... OK
  Applying cms.0010_migrate_use_structure... OK
  Applying cms.0011_auto_20150419_1006... OK
  Applying cms.0012_auto_20150607_2207... OK
  Applying cms.0013_urlconfrevision... OK
  Applying cms.0014_auto_20160404_1908... OK
  Applying cms.0015_auto_20160421_0000... OK
  Applying cms.0016_auto_20160608_1535... OK
  Applying cms.0017_pagetype... OK
  Applying cms.0018_create_pagenode... OK
  Applying cms.0019_set_pagenode... OK
  Applying cms.0020_old_tree_cleanup... OK
  Applying djangocms_column.0001_initial... OK
  Applying djangocms_column.0002_auto_20160915_0818... OK
  Applying filer.0001_initial... OK
  Applying filer.0002_auto_20150606_2003... OK
  Applying filer.0003_thumbnailoption... OK
  Applying filer.0004_auto_20160328_1434... OK
  Applying filer.0005_auto_20160623_1425... OK
  Applying filer.0006_auto_20160623_1627... OK
  Applying djangocms_file.0001_initial... OK
  Applying djangocms_file.0002_auto_20151202_1551... OK
  Applying djangocms_file.0003_remove_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_file.0004_set_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_file.0005_auto_20160119_1534... OK
  Applying djangocms_file.0006_migrate_to_filer... OK
  Applying djangocms_file.0007_adapted_fields... OK
  Applying djangocms_file.0008_add_folder... OK
  Applying djangocms_file.0009_fixed_null_fields... OK
  Applying djangocms_file.0010_removed_null_fields... OK
  Applying filer.0007_auto_20161016_1055... OK
  Applying djangocms_googlemap.0001_initial... OK
  Applying djangocms_googlemap.0002_auto_20160622_1031... OK
  Applying djangocms_googlemap.0003_auto_20160825_1829... OK
  Applying djangocms_googlemap.0004_adapted_fields... OK
  Applying djangocms_googlemap.0005_create_nested_plugins... OK
  Applying djangocms_googlemap.0006_remove_fields... OK
  Applying djangocms_googlemap.0007_reset_null_values... OK
  Applying djangocms_googlemap.0008_removed_null_fields... OK
  Applying djangocms_googlemap.0009_googlemapmarker_icon... OK
  Applying djangocms_link.0001_initial... OK
  Applying djangocms_link.0002_auto_20140929_1705... OK
  Applying djangocms_link.0003_auto_20150212_1310... OK
  Applying djangocms_link.0004_auto_20150708_1133... OK
  Applying djangocms_link.0005_auto_20151003_1710... OK
  Applying djangocms_link.0006_remove_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_link.0007_set_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_link.0008_link_attributes... OK
  Applying djangocms_link.0009_auto_20160705_1344... OK
  Applying djangocms_link.0010_adapted_fields... OK
  Applying djangocms_link.0011_fixed_null_values... OK
  Applying djangocms_link.0012_removed_null... OK
  Applying djangocms_link.0013_fix_hostname... OK
  Applying djangocms_picture.0001_initial... OK
  Applying djangocms_picture.0002_auto_20151018_1927... OK
  Applying djangocms_picture.0003_migrate_to_filer... OK
  Applying djangocms_picture.0004_adapt_fields... OK
  Applying djangocms_picture.0005_reset_null_values... OK
  Applying djangocms_picture.0006_remove_null_values... OK
  Applying djangocms_picture.0007_fix_alignment... OK
  Applying djangocms_picture.0008_picture_use_responsive_image... OK
  Applying djangocms_snippet.0001_initial... OK
  Applying djangocms_snippet.0002_snippet_slug... OK
  Applying djangocms_snippet.0003_auto_data_fill_slug... OK
  Applying djangocms_snippet.0004_auto_alter_slug_unique... OK
  Applying djangocms_snippet.0005_set_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_snippet.0006_auto_20160831_0729... OK
  Applying djangocms_snippet.0007_auto_alter_template_helptext... OK
  Applying djangocms_style.0001_initial... OK
  Applying djangocms_style.0002_set_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_style.0003_adapted_fields... OK
  Applying djangocms_style.0004_use_positive_small_integer_field... OK
  Applying djangocms_style.0005_reset_null_values... OK
  Applying djangocms_style.0006_removed_null_fields... OK
  Applying djangocms_style.0007_style_template... OK
  Applying djangocms_text_ckeditor.0001_initial... OK
  Applying djangocms_text_ckeditor.0002_remove_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_text_ckeditor.0003_set_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_text_ckeditor.0004_auto_20160706_1339... OK
  Applying djangocms_video.0001_initial... OK
  Applying djangocms_video.0002_set_related_name_for_cmsplugin_ptr... OK
  Applying djangocms_video.0003_field_adaptions... OK
  Applying djangocms_video.0004_move_to_attributes... OK
  Applying djangocms_video.0005_migrate_to_filer... OK
  Applying djangocms_video.0006_field_adaptions... OK
  Applying djangocms_video.0007_create_nested_plugin... OK
  Applying djangocms_video.0008_reset_null_values... OK
  Applying djangocms_video.0009_removed_null_values... OK
  Applying djangocms_video.0010_videoplayer_parameters... OK
  Applying easy_thumbnails.0001_initial... OK
  Applying easy_thumbnails.0002_thumbnaildimensions... OK
  Applying filer.0008_auto_20171117_1313... OK
  Applying filer.0009_auto_20171220_1635... OK
  Applying filer.0010_auto_20180414_2058... OK
  Applying menus.0001_initial... OK
  Applying sessions.0001_initial... OK
  Applying sites.0002_alter_domain_unique... OK
Creating admin user
All done!
Get into "/home/maciek/Projects/martacms" directory and type "python manage.py runserver" to start your project
When I runserver and try to add new page, I get an AttributeError.
[14/Nov/2018 17:40:17] "GET /static/djangocms_text_ckeditor/ckeditor/plugins/showblocks/images/block_p.png?t=H8DA HTTP/1.1" 200 115
Internal Server Error: /pl/cms_wizard/create/
Traceback (most recent call last):
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/cms/wizards/views.py", line 45, in dispatch
    return super(WizardCreateView, self).dispatch(*args, **kwargs)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/formtools/wizard/views.py", line 248, in dispatch
    response = super(WizardView, self).dispatch(request, *args, **kwargs)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/formtools/wizard/views.py", line 309, in post
    return self.render_done(form, **kwargs)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/formtools/wizard/views.py", line 365, in render_done
    done_response = self.done(final_forms.values(), form_dict=final_forms, **kwargs)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/cms/wizards/views.py", line 145, in done
    instance = form_two.save()
  File "/usr/lib/python3.6/contextlib.py", line 52, in inner
    return func(*args, **kwds)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/cms/forms/wizards.py", line 194, in save
    add_plugin(**opts)
  File "/usr/lib/python3.6/contextlib.py", line 52, in inner
    return func(*args, **kwds)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/cms/api.py", line 325, in add_plugin
    plugin.save()
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/djangocms_text_ckeditor/models.py", line 58, in save
    body = clean_html(body, full=False)
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/djangocms_text_ckeditor/html.py", line 66, in clean_html
    kwargs = _filter_kwargs()
  File "/home/maciek/.local/share/virtualenvs/martacms-9RJn6Jj_/lib/python3.6/site-packages/djangocms_text_ckeditor/html.py", line 21, in _filter_kwargs
    'allowed_elements': sanitizer.allowed_elements | frozenset(
AttributeError: module 'html5lib.filters.sanitizer' has no attribute 'allowed_elements'
[14/Nov/2018 17:40:28] "POST /pl/cms_wizard/create/ HTTP/1.1" 500 153204

@yakky
Copy link
Member

yakky commented Nov 21, 2018

@m-aciek the source of the issue is actually a bit differnt in your case. it's fixed in #335 which should yield to a 1.0.2 release later today
thanks for reporting!

@oshanz
Copy link

oshanz commented Mar 4, 2019

@m-aciek did you manage to make Django-cms run in a pipenv virtual environment? I can't pass the project create step.

@yakky
Copy link
Member

yakky commented Mar 5, 2019

@oshanz could you open a separate issue for this?
I am not using pipenv myself, so I have not given a though. But I am open to discuss how to implement this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants