You are here: Home / Documentation / How To's / Plone Advanced Search Error

Plone Advanced Search Error

by hrenj — published Nov 01, 2012 11:27 AM, last modified Aug 16, 2016 10:50 AM
When looking at the search results of a regular search, there is an Advance Search button.

We had a problem with the Advanced Search page rendering an error.  The use case involved a user searching for something using the Plone search box.  When the results of that search come back, the user is given an opportunity to conduct an advance search.  When this button was clicked, this error stack came back:

  • Module zope.tales.tales, line 696, in evaluate
    URL: /COBIntranet/portal_skins/custom/search_form
    Line 162, Column 24
    Expression: <PythonExpr portal_types.getTypeInfo(type).Title() or type>
    Names:
    {'container': <PloneSite at /COBIntranet>,
     'context': <PloneSite at /COBIntranet>,
     'default': <object object at 0x2ba6483b1b20>,
     'here': <PloneSite at /COBIntranet>,
     'loop': {u'sublist': <Products.PageTemplates.Expressions.PathIterator object at 0x2aaade850f50>,
              u'type': <Products.PageTemplates.Expressions.PathIterator object at 0x2aaade90fb50>},
     'nothing': None,
     'options': {'args': ()},
     'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x2aaadc2eb8e8>,
     'request': <HTTPRequest, URL=https://plonedev.uwosh.edu/cobintranet/search_form>,
     'root': <Application at >,
     'template': <ZopePageTemplate at /COBIntranet/search_form>,
     'traverse_subpath': [],
     'user': <PloneUser 'waynej'>}
  • Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__
    __traceback_info__: portal_types.getTypeInfo(type).Title() or type
  • Module PythonExpr, line 1, in <expression>

AttributeError: 'NoneType' object has no attribute 'Title'

 

The problem was diagnosed albieback on devplone.org.  It involvesportal_type index value in the portal_catalog has a value) that does not correspond to any value in the portal_type tool, and the catalog type is not listed in the typesNotSearched site property, the Advanced Search form will give an error.  

The fix is changing this on line 165 or so to:

 <label for=""
                               i18n:translate=""
                               tal:attributes="for string:portal_type_${repeat/sublist/number}_${repeat/type/number}"
                               tal:content="python: portal_types.getTypeInfo(type).Title()"
                               />
                        <br />


to this:

 <label for=""

                                    i18n:translate=""

                                    tal:attributes="for string:portal_type_${repeat/sublist/number}_${repeat/type/number}"

                                    tal:condition="python: portal_types.getTypeInfo(type)"

                                    tal:content="python: portal_types.getTypeInfo(type).Title()"

                   />

                          <br tal:condition="python: portal_types.getTypeInfo(type)" /> 

 

this fix is different than the on offered by albieback.

 

Navigation