2009-06-24 46 views
3

我在以下幾個視圖中看到以下錯誤。這似乎與此處所述other kss_generic_macros後的內容相同。提供了一個答案,即「這是由於2.5-> 3.0遷移過程無法將Plone_kss圖層添加到我們的一些自定義外觀引起的。當我進入並將plone_kss手動添加到這些外觀時,它修復了這個問題將Plone 2.5x遷移到Plone 3.x後,如何糾正kss_generic_macros問題?

這是唯一有用的。一個代碼示例或一個真正的指針,指向你添加plone_kss的地方,這將更容易解決。

2009-06-24 15:24:28 ERROR Zope.SiteErrorLog 1245871468.060.103936823493 https://nasascience.on.my.mac/humanator-folder/what-is-six-plus-3/base_view 
Traceback (innermost last): 
    Module ZPublisher.Publish, line 119, in publish 
    Module ZPublisher.mapply, line 88, in mapply 
    Module ZPublisher.Publish, line 42, in call_object 
    Module Shared.DC.Scripts.Bindings, line 313, in __call__ 
    Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec 
    Module Products.CMFCore.FSPageTemplate, line 216, in _exec 
    Module Products.CacheSetup.patch_cmf, line 29, in FSPT_pt_render 
    Module Products.CacheSetup.patch_utils, line 9, in call_pattern 
    Module Products.CMFCore.FSPageTemplate, line 155, in pt_render 
    Module Products.CacheSetup.patch_cmf, line 77, in PT_pt_render 
    Module Products.CacheSetup.patch_utils, line 9, in call_pattern 
    Module Products.PageTemplates.PageTemplate, line 98, in pt_render 
    Module zope.pagetemplate.pagetemplate, line 117, in pt_render 
    - Warning: Macro expansion failed 
    - Warning: exceptions.KeyError: 'macro' 
    Module zope.tal.talinterpreter, line 271, in __call__ 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 891, in do_useMacro 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 521, in do_optTag 
    Module zope.tal.talinterpreter, line 516, in no_tag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 525, in do_optTag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 957, in do_defineSlot 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 521, in do_optTag 
    Module zope.tal.talinterpreter, line 516, in no_tag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 861, in do_defineMacro 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 957, in do_defineSlot 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 521, in do_optTag 
    Module zope.tal.talinterpreter, line 516, in no_tag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 525, in do_optTag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 949, in do_defineSlot 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 521, in do_optTag 
    Module zope.tal.talinterpreter, line 516, in no_tag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 861, in do_defineMacro 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 521, in do_optTag 
    Module zope.tal.talinterpreter, line 516, in no_tag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 891, in do_useMacro 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 536, in do_optTag_tal 
    Module zope.tal.talinterpreter, line 521, in do_optTag 
    Module zope.tal.talinterpreter, line 516, in no_tag 
    Module zope.tal.talinterpreter, line 346, in interpret 
    Module zope.tal.talinterpreter, line 870, in do_useMacro 
    Module zope.tales.tales, line 696, in evaluate 
    - URL: file:/Users/danny/projects/schwa/2.1.0a/trunk/eggs/Products.Archetypes-1.5.10-py2.4.egg/Products/Archetypes/skins/archetypes/base.pt 
    - Line 22, Column 10 
    - Expression: <PathExpr standard:u'here/kss_generic_macros/macros/generic_title_view'> 
    - Names: 
     {'container': <PloneSite at /msrd>, 
     'context': <Humanatorquestion at /msrd/humanator-folder/what-is-six-plus-3>, 
     'default': <object object at 0x1bf528>, 
     'here': <Humanatorquestion at /msrd/humanator-folder/what-is-six-plus-3>, 
     'loop': {}, 
     'nothing': None, 
     'options': {'args':()}, 
     'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x9ea75f8>, 
     'request': <HTTPRequest, URL=https://nasascience.on.my.mac/humanator-folder/what-is-six-plus-3/base_view>, 
     'root': <Application at >, 
     'template': <FSPageTemplate at /msrd/base_view used for /msrd/humanator-folder/what-is-six-plus-3>, 
     'traverse_subpath': [], 
     'user': <PloneUser 'admin'>} 
    Module zope.tales.expressions, line 217, in __call__ 
    Module Products.PageTemplates.Expressions, line 155, in _eval 
    Module zope.tales.expressions, line 124, in _eval 
    Module Products.PageTemplates.Expressions, line 82, in boboAwareZopeTraverse 
    Module OFS.Traversable, line 301, in restrictedTraverse 
    Module OFS.Traversable, line 269, in unrestrictedTraverse 
    - __traceback_info__: ([], 'kss_generic_macros') 
AttributeError: kss_generic_macros 
+0

不是一個真正的Python的問題,雖然... – 2009-06-24 20:28:58

回答

4

登錄到ZMI,然後轉到portal_skins工具。現在點擊「屬性」標籤。該「Plone默認」的皮膚應該是這個樣子:

custom 
cmfeditions_views 
CMFEditions 
ChangeSet 
kupu_plone 
kupu 
kupu_tests 
archetypes 
archetypes_kss 
mimetypes_icons 
plone_kss 
ATContentTypes 
ATReferenceBrowserWidget 
ResourceRegistries 
PasswordReset 
gruf 
plone_ecmascript 
plone_wysiwyg 
plone_prefs 
plone_portlets 
plone_templates 
plone_styles 
plone_form_scripts 
plone_scripts 
plone_forms 
plone_images 
plone_content 
plone_login 
plone_deprecated 
plone_3rdParty 
cmf_legacy 

如果你缺少其中任何你需要添加它們在這應該解決的問題。

3

你缺少plone_kss層在你的皮膚。轉到ZMI(通過網站設置或通過添加/管理您的Plone主頁),找到portal_skins工具,並在屬性選項卡中檢查您的皮膚圖層。確保plone_kss圖層在自定義圖層之前列出,並且應該設置爲去。

未來,您可以使用像find這樣的命令行工具來定位缺少的皮膚方法;我發現這是一個擴建使用以下命令:

$ find parts/plone -name kss_generic_macros.* 
parts/plone/CMFPlone/skins/plone_kss/kss_generic_macros.pt 

你可以用下面的Python腳本自動完成:

from Products.CMFCore.utils import getToolByName 
layer = 'plone_kss' 
skins = getToolByName(context, 'portal_skins') 
for name in skins.getSkinSelections(): 
    path = skins.getSkinPath(name) 
    path = [i.strip() for i in path.split(',')] 
    if layer not in path: 
     try: 
      path.insert(path.index('custom') + 1, layer) 
     except ValueError: 
      path.append(layer) 
     skins.addSkinSelection(name, ','.join(path)) 

這個腳本遍歷在外觀工具的所有皮膚,並會將plone_kss插入缺失的任何一個;要麼在custom層之後,要麼在最後如果沒有custom層存在。

您希望您的custom圖層處於第一位的原因是,此圖層按照自定義(無雙關語)持有皮膚資產的自定義版本。如果要通過ZMI從portal_kss圖層中自定義資產,則自定義版本將被放入custom圖層中。由於外觀查找規則將從頂層到底層查看層堆棧,因此您需要確保在底層的原始文件之前找到custom圖層中的自定義版本。

+0

的Martijn,當我嘗試了您的解決方案,增加plone_kss之前或之後的定製工作。 – pydanny 2009-06-25 13:35:58