Ticket #5549 (closed Bug: fixed)

Opened 6 years ago

Last modified 5 years ago

Plone 2.1.3 and PloneArticle 3.2.0 brakes visual editor kupu

Reported by: paslev Owned by: duncan
Priority: major Milestone: 2.1.4
Component: Visual Editor Keywords: kupu PloneArticle
Cc:

Description (last modified by wichert) (diff)

The following error occures if you try to edit an article:

Traceback (innermost last):
  Module ZPublisher.Publish, line 114, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 40, in call_object
  Module Products.CMFFormController.FSControllerPageTemplate, line 102, in __call__
  Module Products.CMFFormController.BaseControllerPageTemplate, line 46, in _call
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.CMFCore.FSPageTemplate, line 195, in _exec
  Module Products.CMFCore.FSPageTemplate, line 134, in pt_render
  Module Products.PageTemplates.PageTemplate, line 104, in pt_render
   - <FSControllerPageTemplate at /intranet/base_edit used for /intranet/Members/jsi/merkzettel-intranet>
  Module TAL.TALInterpreter, line 206, in __call__
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 690, in do_defineMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 742, in do_defineSlot
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 690, in do_defineMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 734, in do_defineSlot
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 690, in do_defineMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 742, in do_defineSlot
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 653, in do_loop_tal
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 677, in do_condition
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 677, in do_condition
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 424, in do_optTag_tal
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 734, in do_defineSlot
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 426, in do_optTag_tal
  Module TAL.TALInterpreter, line 411, in do_optTag
  Module TAL.TALInterpreter, line 406, in no_tag
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 711, in do_useMacro
  Module TAL.TALInterpreter, line 250, in interpret
  Module TAL.TALInterpreter, line 477, in do_setLocal_tal
  Module Products.PageTemplates.TALES, line 221, in evaluate
   - URL: file:kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html
   - Line 32, Column 5
   - Expression: <PythonExpr here.contentUsesKupu(fname)>
   - Names:
      {'container': <PloneSite at /intranet>,
       'context': <PloneArticle at /intranet/Members/jsi/merkzettel-intranet>,
       'default': <Products.PageTemplates.TALES.Default instance at 0x8b5f8ac>,
       'here': <PloneArticle at /intranet/Members/jsi/merkzettel-intranet>,
       'loop': <Products.PageTemplates.TALES.SafeMapping object at 0xa31ba4c>,
       'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x8b717cc>,
       'nothing': None,
       'options': {'args': (),
                   'state': <Products.CMFFormController.ControllerState.ControllerState object at 0xe9df80c>},
       'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0xa31ba4c>,
       'request': <HTTPRequest, URL=http://intranet.nnn.de/Members/jsi/merkzettel-intranet/base_edit>,
       'root': <Application at >,
       'template': <FSControllerPageTemplate at /intranet/base_edit used for /intranet/Members/jsi/merkzettel-intranet>,
       'traverse_subpath': [],
       'user': jsi}
  Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
   - __traceback_info__: here.contentUsesKupu(fname)
  Module Python expression "here.contentUsesKupu(fname)", line 1, in <expression>
  Module Products.CMFCore.FSPythonScript, line 108, in __call__
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.CMFCore.FSPythonScript, line 164, in _exec
  Module None, line 8, in contentUsesKupu
   - <FSPythonScript at /intranet/contentUsesKupu used for /intranet/Members/jsi/merkzettel-intranet>
   - Line 8
  Module Products.kupu.plone.plonelibrarytool, line 186, in isKupuEnabled
TypeError: iteration over non-sequence

Change History

comment:1 Changed 6 years ago by ctxlken

  • Keywords kupu PloneArticle added
  • Milestone changed from 2.1.x to 2.1.3

I just ran into this defect as well.

The parameter of kupu\plone\kupu_plone_layer\contentUsesKupu.py is looking for 'fieldname', and when kupu_wysiwyg_support.html calls here.contentUsersKupu(fname) as it does below, the contentUsersKupu.py script seems to not like the value it's being passed:

<tal:usekupu define="fname fieldName|inputname|nothing;

usekupu python:here.contentUsesKupu(fname);">

Does anyone have a fix for this yet, or is the recommendation to rollback the version of kupu?

comment:2 Changed 6 years ago by wichert

  • Description modified (diff)
  • Milestone changed from 2.1.3 to 2.1.x

comment:3 Changed 6 years ago by duncan

It looks to me as though the problem is that the allowable_content_types attribute for the field isn't iterable. So far as I can see from the Archetypes documentation this attribute should always be a tuple, but a quick look at PloneArticle shows it is using a ComputedAttribute whatever one of those is (and has a note in its TODO list to stop using ComputedAttribute).

I guess the solution for now is either downgrade kupu or upgrade PloneArticle. I don't have any experience of ComputedAttribute so I'm not really sure how I'm supposed to get at the underlying value. It looks like it dereferences itself when wrapped in an acquisition wrapper, which is fine if it was a Zope class, but kind of stupid when it is just supposed to be a tuple. Any Zope wizards care to enlighten me?

The Kupu code in question is:

        if context is not None and fieldName:
            field = context.getField(fieldName)
            if field:
                allowedTypes = getattr(field, 'allowable_content_types', None)
                if allowedTypes is not None and not 'text/html' in [t.lower() for t in allowedTypes]:
                    return False

I'm guessing this might work for PloneArticle if it called getWrappedField instead of getField, but that really is only a guess. Perhaps someone could try it?

comment:4 Changed 6 years ago by wooda

Yes it's right, it is necessary to change in plonelibrarytool.py getField with getWrappedField

comment:5 Changed 6 years ago by leejoramo

changing the above code from getField to getWrappedField works for me too.

comment:6 Changed 6 years ago by duncan

  • Status changed from new to closed
  • Resolution set to fixed

Ok, I've done that (plone 2.1 branch)

comment:7 Changed 5 years ago by hannosch

  • Milestone changed from 2.1.x to 2.1.4
Note: See TracTickets for help on using tickets.