Changing display to folder_listing

hi,

when i change the display view of a folder (dexterity LRF (pam)) to "tabular view" i got the error below.
(i upgraded plone from 3 to 4 and then to 5 - and also migrated linguaplone to plone.app.multilingual)
thanks in advance
gruss juergen

Traceback (innermost last):
...
Module a6c2fc933452c35856be21ed2a2aacfc.py, line 96, in render_content_core
Module a6c2fc933452c35856be21ed2a2aacfc.py, line 1146, in render_listing
Module five.pt.expressions, line 154, in call
Module five.pt.expressions, line 126, in traverse
Module zope.traversing.adapters, line 136, in traversePathElement

  • traceback_info: (<Products.Five.metaclass.Plone object at 0x7fad9cdd6210>, 'batch')
    Module zope.traversing.adapters, line 50, in traverse

  • traceback_info: (<Products.Five.metaclass.Plone object at 0x7fad9cdd6210>, 'batch', ())
    LocationError: (<Products.Five.metaclass.Plone object at 0x7fad9cdd6210>, 'batch')

  • Expression: "view/batch"

  • Filename: ... -py2.7.egg/plone/app/dexterity/browser/folder_listing.pt

  • Location: (line 14: col 31)

  • Source: <tal:results define="batch view/batch">
    ^^^^^^^^^^

  • Arguments: repeat: {...} (0)
    template: <ImplicitAcquisitionWrapper folder_summary_view at 0x7fada4033820>
    modules: <instance - at 0x7fadaca9b098>
    here: <ImplicitAcquisitionWrapper en at 0x7fada4033af0>
    user: <ImplicitAcquisitionWrapper - at 0x7fada40334b0>
    nothing: <NoneType - at 0x8fd4d0>
    container: <ImplicitAcquisitionWrapper teodor at 0x7fada47c9f00>
    default: <object - at 0x7fadb4d06590>
    request: <instance - at 0x7fad9fe310e0>
    wrapped_repeat: <SafeMapping - at 0x7fad9d7cd890>
    traverse_subpath: <list - at 0x7fad9fda7c20>
    loop: {...} (0)
    context: <ImplicitAcquisitionWrapper en at 0x7fada4033af0>
    translate: <function translate at 0x7fad9ccd3b18>
    root: <ImplicitAcquisitionWrapper Zope at 0x7fada47c9c30>
    options: {...} (1)
    target_language: <NoneType - at 0x8fd4d0>

A traceback is important information. However, in general, the exception is necessary as well.

I expect that you see an exception caused by a failing "traversal" (likely view is lacking batch). This would indicate a Plone bug.

the exception is caught by Plone code.

Could it be that you have some customised templates in /portal_skins/custom or /portal_view_customization ?

Inspect contained items. They may not have their language fields set.

thanks for your help

when i try to set the content language of a item within the folder then the drop-down box (Available Languages) is empty.
then i checked the language settings of all items in the root language folder (en) and it seems that all languages are set correctly. here is the code i used:

    pc=api.portal.get_tool(name='portal_catalog')
    brains= pc.searchResults(path={'query': "/teodor/en"},Language="en")                                                                                                                                                                                                    
    for brain in brains:
       obj=brain.getObject()
       print brain.getURL()," ",obj.language
       language = ILanguage(obj).get_language()
       print language

thanks for your help

no - i removed this before i upgraded to plone 5

hi,

i got also an error when changing display of archetype-based folderish content to "tabular view" (see below)
thanks
js

2018-03-11T09:28:46 ERROR Zope.SiteErrorLog 1520756926.890.471837372382 .../teodor/de/coordination-teams-de/folder_tabular_view
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Shared.DC.Scripts.Bindings, line 322, in call
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 237, in _exec
Module Products.CMFCore.FSPageTemplate, line 177, in pt_render
Module Products.PageTemplates.PageTemplate, line 87, in pt_render
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module five.pt.engine, line 98, in call
Module z3c.pt.pagetemplate, line 163, in render
Module chameleon.zpt.template, line 261, in render
Module chameleon.template, line 191, in render
Module chameleon.template, line 171, in render
Module e7d0773f8cc414e39749b7a82eba209c.py, line 857, in render
Module cc18627f7030d3238e96965f1c8c0be9.py, line 1223, in render_master
Module cc18627f7030d3238e96965f1c8c0be9.py, line 420, in render_content
Module e7d0773f8cc414e39749b7a82eba209c.py, line 843, in __fill_content_core
Module e7d0773f8cc414e39749b7a82eba209c.py, line 767, in render_listing
Module 8c67e8988e97db6e150fd03bfdc57737.py, line 122, in render_content_core
Module 8c67e8988e97db6e150fd03bfdc57737.py, line 874, in render_listing
Module e7d0773f8cc414e39749b7a82eba209c.py, line 744, in __fill_entries
Module 8c67e8988e97db6e150fd03bfdc57737.py, line 473, in render_entries
Module e7d0773f8cc414e39749b7a82eba209c.py, line 732, in __fill_entry
Module e7d0773f8cc414e39749b7a82eba209c.py, line 140, in render_listitem
Module chameleon.utils, line 406, in getitem
NameError: getText

  • Expression: "item_icon/url"
  • Filename: ... ucts/CMFPlone/skins/plone_content/folder_tabular_view.pt
  • Location: (line 46: col 52)
  • Source: tal:condition="item_icon/url"
    ^^^^^^^^^^^^^
  • Expression: "nocall:context/aq_explicit/getText"
  • Filename:
  • Location: (line 0: col 0)
  • Arguments: repeat: {...} (0)
    template: <ImplicitAcquisitionWrapper folder_tabular_view at 0x7f98773e5d70>
    modules: <instance - at 0x7f9890179098>
    here: <ImplicitAcquisitionWrapper coordination-teams-de at 0x7f98775b2f50>
    user: <ImplicitAcquisitionWrapper - at 0x7f9877578b40>
    nothing: <NoneType - at 0x8fd4d0>
    container: <ImplicitAcquisitionWrapper teodor at 0x7f98775b2140>
    default: <object - at 0x7f98983e4590>
    request: <instance - at 0x7f98773f5c68>
    wrapped_repeat: <SafeMapping - at 0x7f98770abe68>
    traverse_subpath: <list - at 0x7f9877230878>
    loop: {...} (1)
    context: <ImplicitAcquisitionWrapper coordination-teams-de at 0x7f98775b2f50>
    translate: <function translate at 0x7f9875973f50>
    root: <ImplicitAcquisitionWrapper Zope at 0x7f98775b21e0>
    options: {...} (1)
    target_language: <NoneType - at 0x8fd4d0>

It is really strange that you should get a NameError (!) getText.

NameError typically indicates a programming error -- using a variable without a previous definition. However, the traceback above would indicate that this error can only come from line 406 of chameleon.utils. I would look there, if it contains a getText without a definition in this module.

If not, I would use debugging (I like Products.PDBDebugMode for this) in order to analyse the problem.

unless it's raised specifically

    def __getitem__(self, key):
        try:
            return dict.__getitem__(self, key)
        except KeyError:
            raise NameError(key)

maybe not the best idea to do it, though

Well, here is my take on it
your condition is item_icon/url
it seems that item_icon is an implementation of IContentIcon from plone/app/layout/global/layout.py:

    def getIcon(self, item):
        """Returns an object which implements the IContentIcon interface and
        provides the informations necessary to render an icon. The item
        parameter needs to be adaptable to IContentIcon. Icons can be disabled
        globally or just for anonymous users with the icon_visibility property
        in site_properties.
        """
        context = self.context
        if not self.icons_visible():
            icon = getMultiAdapter((context, self.request, None), IContentIcon)
        else:
            icon = getMultiAdapter((context, self.request, item), IContentIcon)
        return icon

don't seem to have any warranty that icon will not be null.
Result depends on icons_visible() that checks the registry; maybe you could verify that plone.icon_visibility exists and is set to true. In migrations all sorts of unsavory things ca happen.
According to the interface, iconish object has not always an url, but the condition checks just that, so problem can't come from that.
I may be very wrong obviously, without using a debugger it's speculative.

thanks for your reply!

plone.icon_visibility exists and is set to true!
after inserting a breakpoint into plone/app/layout/global/layout.p:getIcon the error still occurs.
i found a topic dealing with the same error message here:

but unfortunately there is also no solution for it.

thanks for your reply!
i can not find chameleon.utils (searched in buildout-cache/eggs and in the python lib dir)

In comment 10 (maybe 9), gp54321 detected where the NameError comes from: apparently, someone decided to convert a KeyError into a NameError. Such exception conversions are almost always a bad idea, mainly, because part of the traceback is thereby lost. Due to this, we cannot find out where precisely the KeyError happened. Based on the name (getText) and the kown part of the traceback, we might assume that your "context object" lack a getText object. I would try to verify this (and then find out why this happens).

I assume that what you want to say is that the breakpoint is not hit.
in fact that's not so surprising; your exception seems to happen in Chameleon handling of the template folder_tabular_view.pt; however I can't see anywhere in the Plone 5.0 code where this template is used (although it is present while it was ripped out of 5.1). OTOH it's in a skin subdirectory, a weird feature dating from Plone 2 it seems, never seen it myself, maybe there is magic at work here :frowning:

I don't think I can do much more about Archetypes and skin, I don't know nearly enough about that. Maybe it's not normal that this template is called, it's certainly impossible with a fresh Plone 5 installation without Archetypes, but maybe there is some case where it's normal for a migrated site.

You could try to debug inside the template code, it's possible to direct Plone to save the templates code on disk by setting environment variables before start, like that:

export CHAMELEON_DEBUG=true
export CHAMELEON_CACHE=/home/plone_daemon/cache
export CHAMELEON_RELOAD=true

Then you can set up a breakpoint inside the template .py generated files (they have phony names like shown in your trace, but the first line gives the original template name)

The error about getText is misleading; the real problem is that the template is trying to do item_icon/url when item_icon is None. I think Chameleon is confused and is reporting an earlier error that was handled by tal:on-error. I just made a change to ATContentTypes to change "item_icon/url" to "item_icon/url|nothing" so that it won't fail when there's no icon.