2009-06-24 1 views
3

いくつかのビューで以下のエラーが表示されます。これは、このother kss_generic_macros投稿に記載されているものと同じように見えます。 "これは、私たちのカスタムスキンにplone_kssレイヤーを追加するのに失敗した2.5から3.0への移行プロセスが原因で発生しました。私が行って、これらのスキンに手作業で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の問題ではありません... –

答えて

4

にログインし、portal_skinsツールに移動します。次に、[プロパティ]タブをクリックします。あなたは、それらを追加する必要がありますそれらのいずれかを欠く場合

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 

問題を解決する必要があること:「Ploneのデフォルト」スキンは次のようになります。

3

スキンにplone_kssレイヤーがありません。 ZMI(サイト設定またはPloneホームページへの追加/管理)、portal_skinsツールを見つけて、プロパティタブでスキンレイヤーを確認してください。カスタムレイヤーの前にplone_kssレイヤーが表示されていることを確認して、移動するように設定する必要があります。

findのようなコマンドラインツールを使用すると、見つからないスキンメソッドを見つけることができます。私は、次のコマンドを使用してビルドアウトで、この1が見つかりました:

$ 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

+0

をカスタムの前に置くことは当然のことですが、カスタマイズされたバージョンがオリジナルレイヤーをオーバーライドするためにカスタムレイヤーに入っているという慣習に違反します。レイヤーを上に置くことで、内容の優先順位を高くすることができます。これが、「カスタム」が最初のものであることが好ましい理由です。 –

+0

カスタムレイヤーを上に置いておかなければならない理由についての説明を含むように答えを更新しました。 –

関連する問題