2011-10-13 60 views
2

我正在使用Plone 4.0.1,並且在搜索portlet中遇到問題。正常的搜索和實時搜索做工精細,但當我嘗試使用高級搜索(通過mysite的/ search_form),我收到以下錯誤堆棧:Plone高級搜索不起作用

Traceback (innermost last): 
     Module ZPublisher.Publish, line 127, in publish 
     Module ZPublisher.mapply, line 77, in mapply 
     Module ZPublisher.Publish, line 47, in call_object 
     Module Shared.DC.Scripts.Bindings, line 324, in __call__ 
     Module Shared.DC.Scripts.Bindings, line 361, in _bindAndExec 
     Module Products.CMFCore.FSPageTemplate, line 240, in _exec 
     Module Products.CMFCore.FSPageTemplate, line 180, in pt_render 
     Module Products.PageTemplates.PageTemplate, line 80, in pt_render 
     Module zope.pagetemplate.pagetemplate, line 115, 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 954, in do_defineSlot 
     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 858, in do_defineMacro 
     Module zope.tal.talinterpreter, line 343, in interpret 
     Module zope.tal.talinterpreter, line 954, in do_defineSlot 
     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 946, in do_defineSlot 
     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 858, in do_defineMacro 
     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 821, in do_loop_tal 
     Module zope.tal.talinterpreter, line 343, in interpret 
     Module zope.tal.talinterpreter, line 821, in do_loop_tal 
     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 633, in do_insertI18nText_tal 
     Module Products.PageTemplates.Expressions, line 227, in evaluateText 
     Module zope.tales.tales, line 696, in evaluate 
     - URL: file:/usr/local/Plone/buildout-cache/eggs/Plone-4.0.1-py2.6.egg/Products/CMFPlone/skins/plone_forms/search_form.pt 
     - Line 162, Column 24 
     - Expression: <PythonExpr portal_types.getTypeInfo(type).Title()> 
     - Names: 
      {'container': <PloneSite at /PROJECT>, 
      'context': <PloneSite at /PROJECT>, 
      'default': <object object at 0x7fe10cfc7ae0>, 
      'here': <PloneSite at /PROJECT>, 
      'loop': {u'sublist': <Products.PageTemplates.Expressions.PathIterator object at 0xc0c58d0>, 
        u'type': <Products.PageTemplates.Expressions.PathIterator object at 0xc0c5a50>}, 
      'nothing': None, 
      'options': {'args':()}, 
      'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xc0fad08>, 
      'request': <HTTPRequest, URL=http://www.PROJECT/search_form>, 
      'root': <Application at >, 
      'template': <FSPageTemplate at /PROJECT/search_form>, 
      'traverse_subpath': [], 
      'user': <PloneUser '[email protected]'>} 
     Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__ 
     - __traceback_info__: portal_types.getTypeInfo(type).Title() 
     Module PythonExpr, line 1, in <expression> 
     Module AccessControl.ImplPython, line 688, in guarded_getattr 
    AttributeError: 'NoneType' object has no attribute 'Title' 

感謝您的幫助!

回答

2

您似乎在portal_types有問題,請檢查一切是否正常。也許某個名稱中帶有空格的內容類型,或者產品是否有問題?

+0

我確實有一些類型的沒有標題,所以我手動設置,但它仍然無法正常工作。許多書名都有空格,你確定這可能是問題嗎?我可以重新命名標題嗎? –

+0

@Brandon:標題應該有空格。這是您需要擔心的類型的「id」。如果你檢查類型的URL,他們中的任何一個在鏈接中是否有'%20'或明顯的空格? –

+0

非常感謝您的幫助,身份證是問題,高級搜索現在可以正常工作。 –

-1

可能是敏捷錯誤,Title的訪問器返回None,目錄將其緩存在元數據/大腦中 - 然後是模板扼流圈。升級到敏捷1.0.3 - IIRC應該爲你解決。

+0

說明:敏捷升級後重新編制目錄。 – sdupton

+0

我沒有安裝敏捷,當我安裝它時,我的整個頁面都無法工作...所以我不得不再次刪除它。重新編制目錄 - 沒有敏捷性 - 也沒有幫助。 –

+0

嗯,這是一個門戶類型的問題(所以可能提供高級表單選擇),與結果集無關。 –

0

這可以通過適當的類型導入&包配置文件來解決。

有一些產品或Zope加載項是一半安裝的。

蠻力修復是重新安裝所有插件,並希望其中一個插件將註冊類型。


然而,對於更多的 「完美主義」 的方法:

  1. 查找與Products.PDBDebugMode FG違規類型
    運行Zope的(這使得Plone的輸入上的異常PDB)

    AttributeError: 'NoneType' object has no attribute 'Title' 
    > /path/to/your/plone/instance/PythonExpr(1)<expression>() 
    (Pdb) portal_types 
    <TypesTool at /plonesite/portal_types> 
    (Pdb) type 
    'NameOfOffendingType' #### <------ HERE!!!!!! 
    (Pdb) portal_types.getTypeInfo(type) is None 
    True ####<--- yup, sure is!!! 
    

2)訪問ZMI並在您的plone站點下,檢查類型工具。您應該注意到,步驟1中標識的違規類型未列出。

3)查找Python包和配置文件「的types.xml」定義此對象: 你應該在的types.xml看到這個地方(希望)

<object name="NameOfOffendingType" 
    meta_type="Factory-based Type Information with dynamic views"/> 

4)現在,你知道包,訪問ZMI並在你的plone站點下進入'portal setup'並點擊'import'選項卡。選擇「選擇配置文件或快照」下的Package/Product(您可以在Package的configure.zcml中找到配置文件名稱)選擇'Types Tool'並點擊'Import Selected Steps'請在第2步中重新檢查類型工具。現在您應該看到列出的「違規類型」。

6)返回並再次嘗試高級搜索。也許這次會起作用。

http://rpatterson.net/blog/products.pdbdebugmode-egg

+0

是的,他們使用變量名'type'。這不是一個內置函數的無知的破壞 - 它只是真的很老的代碼(pre python 2.2):) – FlipMcF