Can’t change text context anymore

49 views
Skip to first unread message

Henning Hraban Ramm

unread,
May 7, 2012, 4:17:51 PM5/7/12
to django-...@googlegroups.com
Suddenly, one of my sites throws 500s if I try to change any
RichTextContent.
It ran an older FeinCMS (1.3 I guess) on appropriate Django; I updated
the whole system to the latest, but the error doesn’t change.
Don’t know if it’s really a FeinCMS problem at all - do you have any
clue?


File "/var/www/mysite/lib/python2.5/site-packages/django/forms/
formsets.py", line 88, in total_form_count
return self.management_form.cleaned_data[TOTAL_FORM_COUNT]

File "/var/www/mysite/lib/python2.5/site-packages/django/forms/
formsets.py", line 75, in _management_form
raise ValidationError('ManagementForm data is missing or has been
tampered with')

ValidationError: [u'ManagementForm data is missing or has been
tampered with']

(The server is running Debian Lenny, that’s why it’s still on Python
2.5)

Greetlings, Hraban

Matthias Kestenholz

unread,
May 8, 2012, 2:41:58 AM5/8/12
to django-...@googlegroups.com
Hi Hraban

On Mon, May 7, 2012 at 10:17 PM, Henning Hraban Ramm
<fiee.v...@gmail.com> wrote:
> Suddenly, one of my sites throws 500s if I try to change any
> RichTextContent.
> It ran an older FeinCMS (1.3 I guess) on appropriate Django; I updated the
> whole system to the latest, but the error doesn’t change.
> Don’t know if it’s really a FeinCMS problem at all - do you have any clue?
>

Somehow the data from Django formsets' management form does not reach
the server. The management form consists of three fields: total form
count, initial form count and the maximal number of forms allowed in
an inline formset.

We don't do anything special with those fields in FeinCMS. The
manipulation of the formsets' values happens only in the "Add content
block" handler, and we call Django's own javascript code there.

The problem seems to be something else though -- I've seen this
problem under two circumstances:

- The form is submitted before the page is completely loaded which
leads to missing fields
- (Especially) Firefox does try harder to preserve the entered form
data when reloading the page after an error happened. Sometimes you
have to navigate somewhere else and back to the item editor so that it
works again.


I'd start having a look at the POSTed data and at the specific inline
formset which raises this error upon instantiation. Is it really the
rich text content formset, or might it be something else?


Hope it helps somewhat
Matthias

Martin J. Laubach

unread,
May 8, 2012, 3:00:13 AM5/8/12
to django-...@googlegroups.com
   Hm, since it happens just after an upgrade, I'd start with the usual suspects:

  * left-over *.pyc files from the previous installation
  * left-over static files (I believe 1.3->1.4 made the switch from media to static, didn't it)

        mjl

Henning Hraban Ramm

unread,
May 8, 2012, 4:36:32 AM5/8/12
to django-...@googlegroups.com
2012/5/8 Martin J. Laubach <goo...@emsi.priv.at>:
>    Hm, since it happens just after an upgrade, I'd start with the usual
> suspects:

Thank you, but the error occurred suddenly in that old installation
(nothing changed, except perhaps some automatic Linux package update)
and didn’t change after the update.

Tested in Safari and Firefox so far.

Matthias, thank you for the explanation; maybe it’s a JS problem? I'll
try to debug.

Greetlings, Hraban

Henning Hraban Ramm

unread,
May 30, 2012, 5:22:53 PM5/30/12
to django-...@googlegroups.com
Am 2012-05-08 um 08:41 schrieb Matthias Kestenholz:

> - The form is submitted before the page is completely loaded which
> leads to missing fields
> - (Especially) Firefox does try harder to preserve the entered form
> data when reloading the page after an error happened. Sometimes you
> have to navigate somewhere else and back to the item editor so that it
> works again.
>
> I'd start having a look at the POSTed data and at the specific inline
> formset which raises this error upon instantiation. Is it really the
> rich text content formset, or might it be something else?

Ok, after a break I tried to finally nail this.
I moved the site to Python 2.7, latest release version of all modules
(except gunicorn, due to problems with 0.14), but still get the
ManagementForm data error (traceback see below) on every save of a
page in admin.

It’s not (only) the RichTextContent, but I can’t even add an empty new
page.
Here is my POST data:

POST:<QueryDict: {
u'_continue': [u'Sichern und weiter bearbeiten'],
u'active': [u'on'],
u'contactformcontent_set-__prefix__-email': [u''],
u'contactformcontent_set-__prefix__-id': [u''],
u'contactformcontent_set-__prefix__-ordering': [u''],
u'contactformcontent_set-__prefix__-parent': [u''],
u'contactformcontent_set-__prefix__-region': [u''],
u'contactformcontent_set-__prefix__-subject': [u''],
u'contactformcontent_set-INITIAL_FORMS': [u'0'],
u'contactformcontent_set-MAX_NUM_FORMS': [u''],
u'contactformcontent_set-TOTAL_FORMS': [u'0'],
u'csrfmiddlewaretoken': [u'79e914b4cd42f614252cee1cbb367xxx'],
u'language': [u'de'],
u'mediafilecontent_set-__prefix__-id': [u''],
u'mediafilecontent_set-__prefix__-mediafile': [u''],
u'mediafilecontent_set-__prefix__-ordering': [u''],
u'mediafilecontent_set-__prefix__-parent': [u''],
u'mediafilecontent_set-__prefix__-position': [u'main'],
u'mediafilecontent_set-__prefix__-region': [u''],
u'mediafilecontent_set-INITIAL_FORMS': [u'0'],
u'mediafilecontent_set-MAX_NUM_FORMS': [u''],
u'mediafilecontent_set-TOTAL_FORMS': [u'0'],
u'order-machine-add-select': [u'richtextcontent', u'richtextcontent'],
u'orderformcontent_set-__prefix__-email': [u''],
u'orderformcontent_set-__prefix__-id': [u''],
u'orderformcontent_set-__prefix__-ordering': [u''],
u'orderformcontent_set-__prefix__-parent': [u''],
u'orderformcontent_set-__prefix__-region': [u''],
u'orderformcontent_set-INITIAL_FORMS': [u'0'],
u'orderformcontent_set-MAX_NUM_FORMS': [u''],
u'orderformcontent_set-TOTAL_FORMS': [u'0'],
u'override_url': [u''],
u'parent': [u'35'],
u'redirect_to': [u''],
u'richtextcontent_set-__prefix__-id': [u''],
u'richtextcontent_set-__prefix__-ordering': [u''],
u'richtextcontent_set-__prefix__-parent': [u''],
u'richtextcontent_set-__prefix__-region': [u''],
u'richtextcontent_set-__prefix__-seen_tidy_warnings': [u''],
u'richtextcontent_set-__prefix__-text': [u''],
u'richtextcontent_set-INITIAL_FORMS': [u'0'],
u'richtextcontent_set-MAX_NUM_FORMS': [u''],
u'richtextcontent_set-TOTAL_FORMS': [u'0'],
u'slug': [u'testbild'],
u'template_key': [u'default'],
u'title': [u'Testbild'],
u'translation_of': [u''],
}>,

Traceback (most recent call last):

File "/var/www/mysite/lib/python2.7/site-packages/django/core/
handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/contrib/
admin/options.py", line 366, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/utils/
decorators.py", line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/views/
decorators/cache.py", line 89, in _wrapped_view_func
response = view_func(request, *args, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/contrib/
admin/sites.py", line 196, in inner
return view(request, *args, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/feincms/module/
page/models.py", line 751, in add_view
extra_context=extra_context)

File "/var/www/mysite/lib/python2.7/site-packages/feincms/admin/
item_editor.py", line 217, in add_view
return super(ItemEditor, self).add_view(request, form_url,
extra_context=context)

File "/var/www/mysite/lib/python2.7/site-packages/django/utils/
decorators.py", line 25, in _wrapper
return bound_func(*args, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/utils/
decorators.py", line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/utils/
decorators.py", line 21, in bound_func
return func(self, *args2, **kwargs2)

File "/var/www/mysite/lib/python2.7/site-packages/django/db/
transaction.py", line 209, in inner
return func(*args, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/contrib/
admin/options.py", line 952, in add_view
prefix=prefix, queryset=inline.queryset(request))

File "/var/www/mysite/lib/python2.7/site-packages/django/forms/
models.py", line 697, in __init__
queryset=qs, **kwargs)

File "/var/www/mysite/lib/python2.7/site-packages/django/forms/
models.py", line 424, in __init__
super(BaseModelFormSet, self).__init__(**defaults)

File "/var/www/mysite/lib/python2.7/site-packages/django/forms/
formsets.py", line 50, in __init__
self._construct_forms()

File "/var/www/mysite/lib/python2.7/site-packages/django/forms/
formsets.py", line 114, in _construct_forms
for i in xrange(self.total_form_count()):

File "/var/www/mysite/lib/python2.7/site-packages/django/forms/
formsets.py", line 88, in total_form_count
return self.management_form.cleaned_data[TOTAL_FORM_COUNT]

File "/var/www/mysite/lib/python2.7/site-packages/django/forms/
formsets.py", line 75, in _management_form
raise ValidationError('ManagementForm data is missing or has been
tampered with')

ValidationError: [u'ManagementForm data is missing or has been
tampered with']


Do you have any clue where my error comes from?



Greetlings, Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)







Henning Hraban Ramm

unread,
May 31, 2012, 6:48:12 AM5/31/12
to django-...@googlegroups.com
Fixed by FeinCMS 1.5.4 :-)

Thank you!
Hraban
Reply all
Reply to author
Forward
0 new messages