Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#600 getPageInfo TypeError: list indices must be integers

open
panjunyong
5
2006-09-06
2006-09-06
Jean Jordaan
No

I'm using Zope 2.9.4, Plone 2.5, Python 2.4.3

When adding a nested content panel, I got this error:

"""
Module Products.PageTemplates.TALES, line 221, in
evaluate
- URL:
file:CMFContentPanels/skins/contentpanels/contentpanels_macros.pt
- Line 26, Column 6
- Expression: <PythonExpr
here.getPageInfo(pageIndex, 'pageCellPad')>
- Names:
{'container': <PloneSite at /plone>,
'context': <ContentPanels at /plone/test-right>,
'default': <Products.PageTemplates.TALES.Default
instance at 0x2aaab0158e60>,
'here': <ContentPanels at /plone/test-right>,
'loop':
<Products.PageTemplates.TALES.SafeMapping object at
0x2aaab44a9950>,
'modules':
<Products.PageTemplates.ZRPythonExpr._SecureModuleImporter
instance at 0x2aaab015a2d8>,
'nothing': None,
'options': {'args': ()},
'repeat':
<Products.PageTemplates.TALES.SafeMapping object at
0x2aaab44a9950>,
'request': <HTTPRequest,
URL=http://blommie:19095/plone/test-right/cp_new_panel_form>,
'root': <Application at >,
'template': <FSPageTemplate at
/plone/cp_new_panel_form used for /plone/test-right>,
'traverse_subpath': [],
'user': <PloneUser 'jean'>}
Module Products.PageTemplates.ZRPythonExpr, line 47,
in __call__
- __traceback_info__: here.getPageInfo(pageIndex,
'pageCellPad')
Module Python expression "here.getPageInfo(pageIndex,
'pageCellPad')", line 1, in <expression>
Module Products.CMFContentPanels.ContentPanels, line
319, in getPageInfo
TypeError: list indices must be integers
"""

To fix it, I made this change in ContentPanels.py:

def getPageInfo(self, pageIndex, infoName):
''' get general info of the page '''
- return self.panelsConfig[pageIndex][infoName]
+ return self.panelsConfig[int(pageIndex)][infoName]

I don't know if this is a right fix: probably pageIndex
shouldn't arrive here as an int.

Discussion