#19 — NotImplementedError: `index` method must be implemented by subclass on Plone 4.0.5

by David Bain last modified Oct 28, 2011 04:45 AM
State Resolved
Version: 0.5.4
Area Functionality
Issue type Bug
Severity Medium
Submitted by David Bain
Submitted on May 10, 2011
Responsible Nathan Van Gheem
Target release:
    Module zope.contentprovider.tales, line 80, in __call__
    Module plone.app.viewletmanager.manager, line 154, in render
    Module plone.app.viewletmanager.manager, line 85, in render
    Module plone.app.layout.viewlets.common, line 48, in render
    Module plone.app.layout.viewlets.common, line 52, in index

NotImplementedError: `index` method must be implemented by subclass.
Steps to reproduce:
Install collective.easyslider 0.5.4 on your Plone 4.0.5 site.
Then visit any item on the site
Added by Michael Lindig on Jul 05, 2011 12:59 PM
the same for Plone 3.3.5 :(
Added by Nathan Van Gheem on Jul 20, 2011 05:29 AM
Issue state: UnconfirmedPostponed
Responsible manager: (UNASSIGNED)vangheem
Is this still happening for either of you? I use this product extensively on plone 3, 4 and now 4.1 sites without issue.

Is that the full traceback? I don't see anything about easyslider in that traceback.
Added by Ken Wasetis at ContextualCorp.com on Oct 27, 2011 07:06 PM
I'm also seeing this issue on a Plone 4.1 site on version 0.7.4 (and 0.7.2a1), while on a Plone 4.0.4 instance on the same server (RHEL 4.1.2) and with version 0.3.2 of easyslider, I have no problem.

I also use 0.7.x on other Plone 4.1 sites (on Ubuntu 10.x and 11.x) that work fine, although I think I've seen this before on one environment or another.

Odd.
Added by Nathan Van Gheem on Oct 27, 2011 08:02 PM
Ken, can you post your traceback? Did you customize the template through portal_view_customizations perhaps?

This is really odd--I can't reproduce.
Added by Ken Wasetis at ContextualCorp.com on Oct 27, 2011 08:37 PM
Actually, upon further inspection, I believe this is more related to the theme that we're using. I've just recently enabled i18ndude and provided translations for our custom content types product, but not for our theme just yet.

Maybe this will be helpful when trying to debug this issue (if it is an easyslider issue in some release) - the problem my theme is at the point of i18n in the main_template.pt - the same block you see below from the Sunburst theme:

       <div id="portal-top"
            class="row"
            i18n:domain="plone"
            tal:condition="not:ajax_load">
<div class="cell width-full position-0">
            <div tal:replace="structure provider:plone.portaltop" />
</div>

For the time being, I don't believe this is easyslider-related. Sorry for the false alarm, but I didn't get many hits when searching for this error and just happened to stumble upon it on the easyslider issue tracker? Seemed too coincidental, but for now maybe it is. For kicks, I'm attaching the traceback in case you think it might be related to easyslider, but I have doubts it is now:


2011-10-27 16:17:02 ERROR Zope.SiteErrorLog 1319746622.890.58526371804 http://localhost:6080/mxdev1/prefs_install_products_form
Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, 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 240, in _exec
  Module Products.CMFCore.FSPageTemplate, line 180, in pt_render
  Module Products.PageTemplates.PageTemplate, line 79, in pt_render
  Module zope.pagetemplate.pagetemplate, line 113, in pt_render
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 852, in do_condition
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 531, in do_optTag_tal
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: file:/var/db/zope/plone41/zeocluster/src/plonetheme.myintranet/plonetheme/myintranet/skins/myintranet_templates/main_template.pt
   - Line 81, Column 8
   - Expression: <StringExpr u'plone.portaltop'>
   - Names:
      {'container': <PloneSite at /mxdev1>,
       'context': <PloneSite at /mxdev1>,
       'default': <object object at 0x2b8294137b20>,
       'here': <PloneSite at /mxdev1>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x1e15eec0>,
       'request': <HTTPRequest, URL=http://localhost:6080/[…]/prefs_install_products_form>,
       'root': <Application at >,
       'template': <FSPageTemplate at /mxdev1/prefs_install_products_form>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>}
  Module zope.contentprovider.tales, line 80, in __call__
  Module plone.app.viewletmanager.manager, line 154, in render
  Module plone.app.viewletmanager.manager, line 85, in render
  Module plone.app.layout.viewlets.common, line 48, in render
  Module plone.app.layout.viewlets.common, line 52, in index
NotImplementedError: `index` method must be implemented by subclass.
2011-10-27 16:17:03 ERROR root Exception while rendering an error message
Traceback (most recent call last):
  File "/var/db/zope/plone41/buildout-cache/eggs/Zope2-2.13.8-py2.6.egg/OFS/SimpleItem.py", line 241, in raise_standardErrorMessage
    v = s(**kwargs)
  File "/var/db/zope/plone41/buildout-cache/eggs/Products.CMFCore-2.2.4-py2.6.egg/Products/CMFCore/FSPythonScript.py", line 130, in __call__
    return Script.__call__(self, *args, **kw)
  File "/var/db/zope/plone41/buildout-cache/eggs/Zope2-2.13.8-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
    return self._bindAndExec(args, kw, None)
  File "/var/db/zope/plone41/buildout-cache/eggs/Zope2-2.13.8-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File "/var/db/zope/plone41/buildout-cache/eggs/Products.PythonScripts-2.13.0-py2.6.egg/Products/PythonScripts/PythonScript.py", line 344, in _exec
    result = f(*args, **kw)
  File "Script (Python)", line 34, in standard_error_message
  File "/var/db/zope/plone41/buildout-cache/eggs/Zope2-2.13.8-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 322, in __call__
    return self._bindAndExec(args, kw, None)
  File "/var/db/zope/plone41/buildout-cache/eggs/Zope2-2.13.8-py2.6.egg/Shared/DC/Scripts/Bindings.py", line 359, in _bindAndExec
    return self._exec(bound_data, args, kw)
  File "/var/db/zope/plone41/buildout-cache/eggs/Products.CMFCore-2.2.4-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 240, in _exec
    result = self.pt_render(extra_context=bound_names)
  File "/var/db/zope/plone41/buildout-cache/eggs/Products.CMFCore-2.2.4-py2.6.egg/Products/CMFCore/FSPageTemplate.py", line 180, in pt_render
    self, source, extra_context
  File "/var/db/zope/plone41/buildout-cache/eggs/Zope2-2.13.8-py2.6.egg/Products/PageTemplates/PageTemplate.py", line 79, in pt_render
    showtal=showtal)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.pagetemplate-3.5.2-py2.6.egg/zope/pagetemplate/pagetemplate.py", line 113, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 888, in do_useMacro
    self.interpret(macro)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 852, in do_condition
    self.interpret(block)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 531, in do_optTag_tal
    self.no_tag(stuff[-2], stuff[-1])
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tal-3.5.2-py2.6.egg/zope/tal/talinterpreter.py", line 742, in do_insertStructure_tal
    structure = self.engine.evaluateStructure(expr)
  File "/var/db/zope/plone41/buildout-cache/eggs/Zope2-2.13.8-py2.6.egg/Products/PageTemplates/Expressions.py", line 218, in evaluateStructure
    text = super(ZopeContext, self).evaluateStructure(expr)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.tales-3.5.1-py2.6.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
  File "/var/db/zope/plone41/buildout-cache/eggs/zope.contentprovider-3.7.2-py2.6.egg/zope/contentprovider/tales.py", line 80, in __call__
    return provider.render()
  File "/var/db/zope/plone41/buildout-cache/eggs/plone.app.viewletmanager-2.0.2-py2.6.egg/plone/app/viewletmanager/manager.py", line 154, in render
    return BaseOrderedViewletManager.render(self)
  File "/var/db/zope/plone41/buildout-cache/eggs/plone.app.viewletmanager-2.0.2-py2.6.egg/plone/app/viewletmanager/manager.py", line 85, in render
    return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
  File "/var/db/zope/plone41/buildout-cache/eggs/plone.app.layout-2.1.8-py2.6.egg/plone/app/layout/viewlets/common.py", line 48, in render
    return self.index()
  File "/var/db/zope/plone41/buildout-cache/eggs/plone.app.layout-2.1.8-py2.6.egg/plone/app/layout/viewlets/common.py", line 52, in index
    '`index` method must be implemented by subclass.')
NotImplementedError: `index` method must be implemented by subclass.



Added by Nathan Van Gheem on Oct 27, 2011 08:45 PM
That does seem a bit too coincidental.

If you ever get a chance, could you please put a debugging call where the error is happening in plone.app.layout-2.1.8-py2.6.egg/plone/app/layout/viewlets/common.py with a pdb prompt and see which actual viewlets it's barfing on?

For instance, right above the line in plone.app.layout-2.1.8-py2.6.egg/plone/app/layout/viewlets/common.py::

raise NotImplementedError(
            '`index` method must be implemented by subclass.')

put::

import pdb; pdb.set_trace()

then, when in the interactive prompt, just enter "self" and see what class is the one giving the problem.
Added by Nathan Van Gheem on Oct 27, 2011 08:47 PM
It is very odd though because the index method should be getting set with the template setting via the zcml registraion::

<browser:viewlet
    name="collective.easyslider"
    manager="plone.app.layout.viewlets.interfaces.IBelowContentTitle"
    class=".viewlet.EasySlider"
    layer="collective.easyslider.interfaces.ISliderLayer"
    permission="zope2.View"
    template="viewlet.pt" />
Added by Ken Wasetis at ContextualCorp.com on Oct 27, 2011 10:09 PM
Sorry to say, but it appears to be Products.Five.viewlet.metaconfigure.EasySlider


Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 46, 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 240, in _exec
  Module Products.CMFCore.FSPageTemplate, line 180, in pt_render
  Module Products.PageTemplates.PageTemplate, line 79, in pt_render
  Module zope.pagetemplate.pagetemplate, line 113, in pt_render
  Module zope.tal.talinterpreter, line 271, in __call__
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 888, in do_useMacro
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 533, in do_optTag_tal
  Module zope.tal.talinterpreter, line 518, in do_optTag
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 852, in do_condition
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 531, in do_optTag_tal
  Module zope.tal.talinterpreter, line 513, in no_tag
  Module zope.tal.talinterpreter, line 343, in interpret
  Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
  Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
  Module zope.tales.tales, line 696, in evaluate
   - URL: file:/var/db/zope/plone41/zeocluster/src/plonetheme.myintranet/plonetheme/myintranet/skins/myintranet_templates/main_template.pt
   - Line 81, Column 8
   - Expression: <StringExpr u'plone.portaltop'>
   - Names:
      {'container': <PloneSite at /mxdev1>,
       'context': <PloneSite at /mxdev1>,
       'default': <object object at 0x2af00fa27b20>,
       'here': <PloneSite at /mxdev1>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x1ce17208>,
       'request': <HTTPRequest, URL=http://localhost:6080/[…]/prefs_install_products_form>,
       'root': <Application at >,
       'template': <FSPageTemplate at /mxdev1/prefs_install_products_form>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>}
  Module zope.contentprovider.tales, line 80, in __call__
  Module plone.app.viewletmanager.manager, line 154, in render
  Module plone.app.viewletmanager.manager, line 85, in render
  Module plone.app.layout.viewlets.common, line 48, in render
  Module plone.app.layout.viewlets.common, line 52, in index
NotImplementedError: `index` method must be implemented by subclass.
> /var/db/zope/plone41/buildout-cache/eggs/plone.app.layout-2.1.8-py2.6.egg/plone/app/layout/viewlets/common.py(52)index()
-> '`index` method must be implemented by subclass.')
(Pdb) (Pdb) self
<Products.Five.viewlet.metaconfigure.EasySlider object at 0x1c984610>
(Pdb)
Added by Ken Wasetis at ContextualCorp.com on Oct 27, 2011 10:35 PM
Again, this is with easyslider 0.7.4. Also, even after I delete my pages that have a slider and then uninstall easyslider, I still get the same error, so I tried something else... I created a brand new site, installed my various add-on products one-by-one successfully, but held off on installing easyslider until the end. Before I could do that, when installing my theme product, it still gets hung up at the same point, and 'self' is still supposedly the easyslider viewlet configuratorl, EVEN THOUGH I haven't even installed easyslider on this site yet!

 
Added by Ken Wasetis at ContextualCorp.com on Oct 27, 2011 10:41 PM
Think I found something - I didn't create this theme. It doesn't declare easyslider as a dependency, but sure seems to be, since I see the following in the theme's /browser/configure.zcml:

    <!-- Move the easyslider -->
    <browser:viewlet
        name="collective.easyslider"
        manager="plone.app.layout.viewlets.interfaces.IPortalTop"
        class="collective.easyslider.browser.viewlet.EasySlider"
        permission="zope2.View"
                layer=".interfaces.IThemeSpecific"
        />

and this in the profiles/default/viewlets.xml:

  <order manager="plone.portaltop" skinname="Elavon Theme" based-on="Sunburst Theme">
  <viewlet name="collective.easyslider" insert-after="plone.header" />
  </order>


Added by Ken Wasetis at ContextualCorp.com on Oct 27, 2011 11:47 PM
I removed those references from those two files and the site theme installed fine.
Added by Nathan Van Gheem on Oct 28, 2011 04:01 AM
Issue state: PostponedConfirmed
Huh, well there you go. I suppose it's an easy fix and perhaps we can add an issue to the theme's project page.

Thanks for digging into that Ken.

Unless I hear anything else regarding the issue, I will be closing this out. Thanks.
Added by Nathan Van Gheem on Oct 28, 2011 04:01 AM
Issue state: ConfirmedResolved
Added by Ken Wasetis at ContextualCorp.com on Oct 28, 2011 04:45 AM
#worksforme - thanks!

No responses can be added.