wagtail-nest / wagtail-polymath

Beautiful equations in your StreamField content.
BSD 3-Clause "New" or "Revised" License
33 stars 14 forks source link

MathJax streamblock widget initially works, then doesn't #3

Open bbrelje opened 6 years ago

bbrelje commented 6 years ago

Hey there, great work on this plugin! It worked great as I edited and published my first test post using equations and the MathJax streamblock widget.

Unfortunately, after I saved a draft of the page for the first time, I went back to edit the test page (add another MathJax widget instance) and observed the following symptoms:

The problem is not universal to all cases with multiple MathJax widgets on one page. I had live previews of two MathJax widgets working at the same time on one occasion.

I think the problem may be related to the GUI changes introduced in wagtail 1.12 but I could easily be wrong about that.

Stack trace:
invalid literal for int() with base 10: ''

Traceback:

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/views/decorators/cache.py" in _cache_controlled
  43.             response = viewfunc(request, *args, **kw)

File "/opt/bitnami/python/lib/python2.7/site-packages/wagtail/wagtailadmin/decorators.py" in decorated_view
  31.             return view_func(request, *args, **kwargs)

File "/opt/bitnami/python/lib/python2.7/site-packages/wagtail/wagtailadmin/views/pages.py" in edit
  321.         if form.is_valid() and not page.locked:

File "/opt/bitnami/python/lib/python2.7/site-packages/modelcluster/forms.py" in is_valid
  259.         form_is_valid = super(ClusterForm, self).is_valid()

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/forms/forms.py" in is_valid
  183.         return self.is_bound and not self.errors

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/forms/forms.py" in errors
  175.             self.full_clean()

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/forms/forms.py" in full_clean
  384.         self._clean_fields()

File "/opt/bitnami/apps/django/lib/python2.7/site-packages/Django-1.11.4-py2.7.egg/django/forms/forms.py" in _clean_fields
  396.                 value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))

File "/opt/bitnami/python/lib/python2.7/site-packages/wagtail/wagtailcore/blocks/base.py" in value_from_datadict
  523.         return self.block_def.value_from_datadict(data, files, name)

File "/opt/bitnami/python/lib/python2.7/site-packages/wagtail/wagtailcore/blocks/stream_block.py" in value_from_datadict
  165.                     int(data['%s-%d-order' % (prefix, i)]),

Exception Type: ValueError at /admin/pages/5/edit/
Exception Value: invalid literal for int() with base 10: ''
JamesRamm commented 6 years ago

Hi Thanks for reporting this. I haven't made any updates/checked any breakages for wagtail 1.12, so this would be my first port of call. I'll do some tests, if you are able, it would help to test with a previous version of wagtail to verify it is isolated to 1.12.