Page Templates, browser/ , and skins

4 Messages Forum Options Options
Permalink
Derek Richardson-2
Page Templates, browser/ , and skins
Reply Threaded More
Print post
Permalink
I am attempting to get a pt I wrote in a z3 way to show in main
template. When I put in the metal calls to embed it in main template, I
get a KeyError on 'here'. I am currently assuming that this happens
because of some magic associated with the skins directories of which I
am not partaking. The only option I see is to put my pt in the skins
directory. However, because this make the pt available on all contexts,
while I want it on a restricted set of contexts (although not a single
content type), I am loath to do this. Do I have another option than
using the skins directories if I want the pt to show in the plone skin?

Traceback and code below sig.

Thanks,

Derek Richardson

2008-07-17 09:29:16 ERROR Zope.SiteErrorLog
http://localhost:8080/site/news/aggregator/@@publishtab
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 foo.bar.browser.publisher, line 56, in __call__
   Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__
   Module zope.app.pagetemplate.viewpagetemplatefile, line 51, in __call__
   Module zope.pagetemplate.pagetemplate, line 117, in pt_render
    - Warning: Macro expansion failed
    - Warning: exceptions.KeyError: 'here'
   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 870, in do_useMacro
   Module zope.tales.tales, line 696, in evaluate
    - URL:
file:/Users/dkr/virtualenvs/zopeskel-trunk/test/parts/plone/CMFPlone/skins/plone_templates/main_template.pt
    - Line 3, Column 0
    - Expression: <PathExpr standard:u'here/global_defines/macros/defines'>
    - Names:
       {'args': (),
        'context': <ATTopic at /site/news/aggregator>,
        'default': <object object at 0x4b528>,
        'loop': {},
        'nothing': None,
        'options': {},
        'repeat': {},
        'request': <HTTPRequest,
URL=http://localhost:8080/site/news/aggregator/@@publishtab>,
        'template':
<zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object
at 0x455d3d0>,
        'usage': <zope.pagetemplate.pagetemplate.TemplateUsage object at
0x84a3430>,
        'view': <Products.Five.metaclass.PublishTab object at 0x842f6f0>,
        'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper
object at 0x84a3530>}
   Module zope.tales.expressions, line 217, in __call__
   Module Products.PageTemplates.Expressions, line 153, in _eval
   Module zope.tales.expressions, line 118, in _eval
KeyError: 'here'

##########

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
       lang="en"
       xmlns:tal="http://xml.zope.org/namespaces/tal"
       xmlns:metal="http://xml.zope.org/namespaces/metal"
       metal:use-macro="context/main_template/macros/master">
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main">
   <h1>Publishing</h1>
   <div>
     Destination:
     <select name="destination">
       <option value="none" selected="true">None</option>
       <tal:block tal:repeat="destination view/destinations">
         <option tal:attributes="value destination;"
                 tal:content="destination" />
       </tal:block>
       <option value="all">All</option>
     </select>
   </div>
   <div style="height: 1em"> </div>
   <div>Last published to [insert]: [insert]</div>
   <div style="height: 1em"> </div>
   <div>
     <button type="submit" name="submit" value="publish">Publish</button>
     <button type="submit" name="submit" value="cancel">Cancel</button>
   </div>
   <div style="height: 1em"> </div>
   <div>
     These items will updated:
     <table>
       <tr>
         <td style="border-bottom: black 1px solid">Item</td>
         <td style="border-bottom: black 1px solid">Last Modified</td>
       </tr>
       <tr><td>dummy</td><td>1/1/2000</td></tr>
     </table>
   </div>
   <div style="height: 1em"> </div>
   <div>
     These items will be deleted:
     <div>dummy</div>
   </div>
   <div style="height: 1em"> </div>
   <div>
     These items will be unchanged:
     <div>dummy</div>
   </div>
</tal:main-macro>
</metal:main>
</body>

</html>


_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers
Daniel Nouri
Re: Page Templates, browser/ , and skins
Reply Threaded More
Print post
Permalink
Use 'context' instead of 'here'.

Derek Richardson writes:

> I am attempting to get a pt I wrote in a z3 way to show in main
> template. When I put in the metal calls to embed it in main template,
> I get a KeyError on 'here'. I am currently assuming that this happens
> because of some magic associated with the skins directories of which I
> am not partaking. The only option I see is to put my pt in the skins
> directory. However, because this make the pt available on all
> contexts, while I want it on a restricted set of contexts (although
> not a single content type), I am loath to do this. Do I have another
> option than using the skins directories if I want the pt to show in
> the plone skin?
>
> Traceback and code below sig.


Daniel


_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers
Derek Richardson-2
Re: Page Templates, browser/ , and skins
Reply Threaded More
Print post
Permalink
Right. That's the problem. main template uses 'here' and I'm not going
to rewrite main template.

That's:

parts/plone/CMFPlone/skins/plone_templates/main_template.pt

to be specific.

Derek

Daniel Nouri wrote:

> Use 'context' instead of 'here'.
>
> Derek Richardson writes:
>
>> I am attempting to get a pt I wrote in a z3 way to show in main
>> template. When I put in the metal calls to embed it in main template,
>> I get a KeyError on 'here'. I am currently assuming that this happens
>> because of some magic associated with the skins directories of which I
>> am not partaking. The only option I see is to put my pt in the skins
>> directory. However, because this make the pt available on all
>> contexts, while I want it on a restricted set of contexts (although
>> not a single content type), I am loath to do this. Do I have another
>> option than using the skins directories if I want the pt to show in
>> the plone skin?
>>
>> Traceback and code below sig.
>
>
> Daniel


_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers
Daniel Nouri
Re: Page Templates, browser/ , and skins
Reply Threaded More
Print post
Permalink
Derek Richardson writes:

> Right. That's the problem. main template uses 'here' and I'm not going
> to rewrite main template.
>
> That's:
>
> parts/plone/CMFPlone/skins/plone_templates/main_template.pt
>
> to be specific.

Hmm.  Are you maybe importing your template from Zope 3 instead of Five?

Daniel


> Daniel Nouri wrote:
>> Use 'context' instead of 'here'.
>>
>> Derek Richardson writes:
>>
>>> I am attempting to get a pt I wrote in a z3 way to show in main
>>> template. When I put in the metal calls to embed it in main template,
>>> I get a KeyError on 'here'. I am currently assuming that this happens
>>> because of some magic associated with the skins directories of which I
>>> am not partaking. The only option I see is to put my pt in the skins
>>> directory. However, because this make the pt available on all
>>> contexts, while I want it on a restricted set of contexts (although
>>> not a single content type), I am loath to do this. Do I have another
>>> option than using the skins directories if I want the pt to show in
>>> the plone skin?
>>>
>>> Traceback and code below sig.


_______________________________________________
Product-Developers mailing list
Product-Developers@...
http://lists.plone.org/mailman/listinfo/product-developers