Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 117261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:18:29+00:00 2026-05-11T03:18:29+00:00

I really like the Mako templating system that’s used in Pylons and a couple

  • 0

I really like the Mako templating system that’s used in Pylons and a couple other Python frameworks, and my only complaint is how much WS leaks through even a simple inheritance scheme.

Is there anyway to accomplish below, without creating such huge WS gaps… or packing my code in like I started to do with base.mako?

Otherwise to get a grip on what I’m trying to accomplish with below.

Base is kind of like interface class for all views for the entire application, layout is just a prototype idea for 3-4 different layout files ( tables, pure CSS, etc ), and controller/action is a test to make sure my idea’s are sane.

Short summary of question: How to cut out the WS created in my Mako scheme?

Update: Is not a solution because it involves seeding all of my mako files with \’s http://www.makotemplates.org/docs/syntax.html#syntax_newline

/base.mako

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'  'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html>   <head><%def name='headtags()'></%def>${self.headtags()}</head>   <body>     <%def name='header()'></%def>${self.header()}${next.body()}<%def name='footer()'></%def>${self.footer()}   </body> </html> 

/layout.mako

<%inherit file='/base.mako'/> <%def name='headtags()'>    ${parent.headtags()}    <script src='http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js'></script> </%def> <%def name='header()'>   <h1>My Blogination</h1> </%def> <div id='content'>${next.body()}</div> 

/controller/action.mako

<%inherit file='/layout.mako' /> <%def name='headtags()'>         <title> Hello world, templating system is 1 percent done</title>     ${parent.headtags()} </%def> Hello ${c.name}!  

rendered output:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html>   <head>         <title> Hello world, templating system is 1 percent done</title>     <script src='http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js'></script>   </head>   <body>    <h1>My Blogination</h1>   <div id='content'>  Hello Anonymous!  </div>    </body> </html> 
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:18:30+00:00Added an answer on May 11, 2026 at 3:18 am

    Found my own answer http://docs.makotemplates.org/en/latest/filtering.html

    It still required some trial and error, but using

    t = TemplateLookup(directories=['/tmp'], default_filters=['trim']) 

    dramatically cut down on whitespace bleed. Additional savings can be found by checking the compiled template’s and looking for any writes that are just pushing ‘ ‘ or similar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really like that function. $matches = array('12', 'watt'); list($value, $unit) = $matches; Is there
I really like Perl's HTTP::Recorder . Is there something like it for Python?
I really like the feature of SQLAlchemy that allows you to see if an
I really like processing XML with e4x, any other method I just get confused
I really like a div box that is styled a particular way on another
I really like Tornado and I would like to use it with Python 3,
I really like the way fakeweb in Ruby can be used to fake http
I really like the coding speed that VB.NET provides, but I don't like the
I really like the fact that Microsoft has taken a commitment to bring MVC
I really like the way gmail has the archive system implemented. I can archive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.