context and mako template

10 views
Skip to first unread message

kaesh...@gmail.com

unread,
Dec 19, 2013, 2:13:14 PM12/19/13
to nive...@googlegroups.com
Hi,

I try to use mako as template, but there is a conflict with context :
NameConflictError: Reserved words passed to render(): context

I found a workaround in pyramid_mako to change request by nive_request but don't know if it's the good way...
To use mako i did a little element :

from nive.definitions import FieldConf, ObjectConf

configuration = ObjectConf(
id="panel",
name="Panel",
dbparam="panel",
context="nive.components.objects.base.PageElementBase",
template="panel:panel.mako",
selectTag=20,
description=""
)

configuration.data = [
FieldConf(id="panel_class", datatype="radio", size=10000, default='primary',
name="Type", listItems=[{'id':'primary', 'name':"Primary"},
{'id':'success', 'name':"Success"},
{'id':'info', 'name':"Info"},
{'id':'warning', 'name':"Warning"},
{'id':'danger', 'name':"Danger"}]),

FieldConf(id="textblock", datatype="htext", size=10000, default="",
name="Text", fulltext=1),
]

configuration.forms = {
"create": {"fields": ["title", "panel_class", "textblock"]},
"edit": {"fields": ["title", "panel_class", "textblock"]}
}

panel.mako

<div class="pageelement panel panel-${nive_context.data.panel_class}" id="nive-element${nive_context.GetID()}">

<div class="panel-heading">
<span>${nive_context.GetTitle()}</span>
</div>
<div class="panel-body">
<p>${nive_context.data.textblock|n}</p>
</div>
</div>

kaesh...@gmail.com

unread,
Dec 21, 2013, 9:19:54 AM12/21/13
to nive...@googlegroups.com
Issue resolved by pyramid_mako
Reply all
Reply to author
Forward
0 new messages