Hello!

I'm trying to use pyramid_layout package for declarative configuration of 
my app. I would like to configure it only in configure.zcml file. 

Here it is:

<configure xmlns="http://pylonshq.com/pyramid";
   xmlns:lat="http://pylonshq.com/pyramid_layout";>

    <include package="pyramid_zcml" />
    <include package="pyramid_layout" file="meta.zcml"/>

    <static
        name="static"
        path="static"
    />

    <!-- layouts -->
    <lat:layout
        name="test"
        layout=".layouts.AppLayout"
        template="templates/layouts/layout1.pt"
    />

    <!-- default view -->
    <view
        view=".views.my_view"
        renderer="templates/home.pt"
        lat:layout="test"
    />

    <view
        name="two"
        view=".views.my_view2"
        renderer="templates/mytemplate2.pt"
    />

</configure>


When I called the default view - got an exception:

NameError: main_template

 - Expression: "main_template"
 - Filename:   ... o\python_test\pyramid7\myzcml1\myzcml1\templates\home.pt
 - Location:   (line 4: col 25)
 - Source:     <metal:block use-macro="main_template">
                                       ^^^^^^^^^^^^^
 - Arguments:  repeat: {...} (0)
               renderer_name: templates/home.pt
               req: <Request - at 0x4a96be0L>
               request: <Request - at 0x4a96be0L>


File home.pt:

<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:tal="http://xml.zope.org/namespaces/tal";
      xmlns:metal="http://xml.zope.org/namespaces/metal"; >
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<h1>It is home view</h1>
<p>Hello home.pt template</p>
<p>Project is: ${project}</p>
</div>
</metal:block>
</html>

What I did wrong in my code? So, is it possible to use pyramid_layout in 
such manner? 

BTW, if I use request.layout_manager.use_layout("test") in view.my_view 
code - it works fine! 

But I want do this work  just in configure.zcml. Is it possible?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to