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:
<include package="pyramid_zcml" />
<include package="pyramid_layout" file="meta.zcml"/>
<static
name="static"
path="static"
/>
<!-- layouts -->
<lat:layout
name="test"
layout=".layouts.AppLayout"
/>
<!-- default view -->
<view
view=".views.my_view"
lat:layout="test"
/>
<view
name="two"
view=".views.my_view2"
/>
</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)
req: <Request - at 0x4a96be0L>
request: <Request - at 0x4a96be0L>
<metal:block use-macro="main_template">
<div metal:fill-slot="content">
<h1>It is home view</h1>
<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?