'NoneType' object has no attribute 'text'
See original GitHub issueFound a bug? Please fill out the sections below. 👍
Issue Summary
We recently upgraded a site to 2.1 and pretty much everything worked (with the steps in the migration guide) but we do have one page type returning an error when we attempt to edit it. Viewing it live works fine.
This is a custom page type that has a StreamField where the editors place custom blocks. Based on the stack trace I’m guessing we have no data in one of them which is causing the problem but I’m not sure how to track it down.
Any thoughts?
Stack Trace
Environment:
Request Method: GET
Request URL: [redacted]/admin/pages/292/edit/
Django Version: 1.11.11
Python Version: 3.6.5
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'taggit',
'compressor',
'modelcluster',
'storages',
'widget_tweaks',
'bootstrap3',
'raven.contrib.django.raven_compat',
'adminsortable',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail.contrib.search_promotions',
'home',
'landing',
'industry',
'contact',
'blog',
'seo',
'careers',
'customer',
'training',
'downloads',
'startup',
'playlist')
Installed Middleware:
('raven.contrib.django.middleware.DjangoRestFrameworkCompatMiddleware',
'raven.contrib.django.middleware.SentryMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'wagtail.core.middleware.SiteMiddleware',
'wagtail.contrib.redirects.middleware.RedirectMiddleware')
Template error:
In template /usr/local/lib/python3.6/site-packages/wagtail/admin/templates/wagtailadmin/block_forms/sequence_member.html, error at line 23
'NoneType' object has no attribute 'text' 13 :
14 : {% endcomment %}
15 : <li id="{{ prefix }}-container" class="sequence-member">
16 : <input type="hidden" id="{{ prefix }}-deleted" name="{{ prefix }}-deleted" value="">
17 : <input type="hidden" id="{{ prefix }}-order" name="{{ prefix }}-order" value="{{ index }}">
18 :
19 : {% block hidden_fields %}{% endblock %}
20 :
21 : {% block header_controls %}{% endblock %}
22 :
23 : <div class="sequence-member-inner {% block sequence_member_inner_classes %}{% endblock %}"> {{ child.render_form }} </div>
24 :
25 : {% block footer_controls %}{% endblock %}
26 : </li>
27 :
Traceback:
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py" in _cache_controlled
43. response = viewfunc(request, *args, **kw)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/urls/__init__.py" in wrapper
102. return view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/decorators.py" in decorated_view
34. return view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/views/pages.py" in edit
534. 'has_unsaved_changes': has_unsaved_changes,
File "/usr/local/lib/python3.6/site-packages/django/shortcuts.py" in render
30. content = loader.render_to_string(template_name, context, request, using=using)
File "/usr/local/lib/python3.6/site-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
207. return self._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
177. return compiled_parent._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
177. return compiled_parent._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
177. return compiled_parent._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
72. result = block.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
72. result = block.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
1040. output = self.filter_expression.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
708. obj = self.var.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
849. value = self._resolve_lookup(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _resolve_lookup
911. current = current()
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py" in render_form_content
230. return mark_safe(self.render_as_object() + self.render_missing_fields())
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py" in render_as_object
198. return self.render()
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py" in render
299. 'self': self
File "/usr/local/lib/python3.6/site-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
207. return self._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py" in render
216. nodelist.append(node.render_annotated(context))
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
1040. output = self.filter_expression.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
708. obj = self.var.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
849. value = self._resolve_lookup(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _resolve_lookup
911. current = current()
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py" in render_as_object
198. return self.render()
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py" in render
299. 'self': self
File "/usr/local/lib/python3.6/site-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
207. return self._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py" in render
216. nodelist.append(node.render_annotated(context))
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
1040. output = self.filter_expression.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
708. obj = self.var.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
849. value = self._resolve_lookup(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _resolve_lookup
911. current = current()
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/edit_handlers.py" in render_as_object
457. 'field': self.bound_field,
File "/usr/local/lib/python3.6/site-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
207. return self._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
216. return template.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
209. return self._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
63. result = self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
1040. output = self.filter_expression.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
736. new_obj = func(obj, *arg_vals)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/templatetags/wagtailadmin_tags.py" in render_with_errors
244. return bound_field.as_widget()
File "/usr/local/lib/python3.6/site-packages/django/forms/boundfield.py" in as_widget
127. **kwargs
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/base.py" in render
505. return self.render_with_errors(name, value, attrs=attrs, errors=None)
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/base.py" in render_with_errors
502. return mark_safe(bound_block.render_form() + js_snippet)
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/base.py" in render_form
417. return self.block.render_form(self.value, self.prefix, errors=self.errors)
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/stream_block.py" in render_form
140. for (i, child) in enumerate(valid_children)
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/stream_block.py" in <listcomp>
140. for (i, child) in enumerate(valid_children)
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/stream_block.py" in render_list_member
77. 'block_id': id,
File "/usr/local/lib/python3.6/site-packages/django/template/loader.py" in render_to_string
68. return template.render(context, request)
File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py" in render
66. return self.template.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
207. return self._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py" in render
177. return compiled_parent._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _render
199. return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
990. bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render_annotated
957. return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in render
1040. output = self.filter_expression.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
708. obj = self.var.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in resolve
849. value = self._resolve_lookup(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py" in _resolve_lookup
911. current = current()
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/base.py" in render_form
417. return self.block.render_form(self.value, self.prefix, errors=self.errors)
File "/usr/local/lib/python3.6/site-packages/wagtail/core/blocks/field_block.py" in render_form
37. widget_html = widget.render(prefix, field_value, attrs=widget_attrs)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/rich_text/editors/draftail/__init__.py" in render
52. translated_value = self.translate_value(value)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/rich_text/editors/draftail/__init__.py" in translate_value
44. return self.converter.from_database_format(value)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/rich_text/converters/contentstate.py" in from_database_format
84. self.html_to_contentstate_handler.feed(html)
File "/usr/local/lib/python3.6/html/parser.py" in feed
111. self.goahead(0)
File "/usr/local/lib/python3.6/html/parser.py" in goahead
173. k = self.parse_endtag(i)
File "/usr/local/lib/python3.6/html/parser.py" in parse_endtag
421. self.handle_endtag(elem.lower())
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/rich_text/converters/html_to_contentstate.py" in handle_endtag
305. element_handler.handle_endtag(name, self.state, self.contentstate)
File "/usr/local/lib/python3.6/site-packages/wagtail/admin/rich_text/converters/html_to_contentstate.py" in handle_endtag
192. entity_range.length = len(state.current_block.text) - entity_range.offset
Exception Type: AttributeError at /admin/pages/292/edit/
Exception Value: 'NoneType' object has no attribute 'text'
Technical details
- Python version: 3.6.5.
- Django version: 1.11.11.
- Wagtail version: 2.1.
- Browser version: N/A.
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (5 by maintainers)
Top Results From Across the Web
(Python) AttributeError: 'NoneType' object has no attribute 'text'
I'm getting the error below when I'm parsing the xml from the URL in the code. I won't post the XML because it's...
Read more >How to Fix the 'NoneType' object has no attribute: 'text' Error in ...
How to Fix the 'NoneType' object has no attribute: 'text' Error? · Double-check the web pages that you will be scraping to get...
Read more >NoneType object has no attribute text | Edureka Community
AttributeError : 'NoneType' object has no attribute 'foo' - This usually happens because you called find() and then tried to access the .foo ......
Read more >How do I fix : attributeerror: 'nonetype' object has no attribute ...
When ever you get a problems that involves a message such as " 'nonetype' object has no attribute ..." it means the same...
Read more >[PyQt] AttributeError: 'NoneType' object has no attribute 'text'
[PyQt] AttributeError: 'NoneType' object has no attribute 'text' ... line gives an error. ... What is the error reason and how can I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A monkey patch on 2.2.2 provides a work-around:
When 3 year old issues like this get closed, everyone involved should get a slice of (delicious, and moist) cake. 🍰