0

I'm using python and pyramid with mako templates on displaying web content. I have html templates that are saved in a database, and now i want to display them on a web page with styles and everything(working urls and images etc.), just like a real html page would be, but fetched from the db.

Input is something like this: general styles:

.footer-content-left { 
    -webkit-text-size-adjust: 80%; 
    -ms-text-size-adjust: 80%
} 

img {
    height: auto; 
    line-height: 100% 
}

h1 a:active {color:red} 

h2 a:active {color:red}

and actual content:

<div style="-ms-text-size-adjust:none; -webkit-text-size-adjust:none; color:#d9fffd; font-size:12px">Awsome link 
    <a style="color:#d9fffd; font-weight:normal; text-decoration:none" href="%7Blink.url:link_foo">
        foo.bar
    </a> 
</div> etc.

Templates are fetched and edited with a premailer like this:

template = DBSession.query(Template).filter(Template.id == '1').first()  
template = transform(template.template) #editing the html code with premailer


return {'template': template}

html code is sent to mako template like this: ${template} , but end result has always been just plain text, like input in above. And code in a HTML templates is working, i'm sure about that.

kylieCatt
  • 10,672
  • 5
  • 43
  • 51
Miro K.
  • 345
  • 1
  • 4
  • 13

1 Answers1

0

Try: ${structure: template}, I don't know that this is an appropriate choice but http://chameleon.readthedocs.org/en/latest/reference.html#structure suggested it might.

Found here

Community
  • 1
  • 1
TankorSmash
  • 12,186
  • 6
  • 68
  • 106
  • Chameleon and mako template seems to be two different things, but if i don't find anything that works with mako templates, this might be the way to go. – Miro K. May 22 '14 at 20:17