Thursday, 15 March 2012

python - Good way to pass variables for common elements to Mako templates? -


I am using Maco's legacy features, such as "Top. In Mac, general page elements such as a header and footer Detecting "template page-specific controllers use their own template, which is the base.

base.mako requires a set of variables - for example, the name of the logged-in user goes to the header for all the pages. However, this is a separate page controller that selects and presents a template, and is therefore responsible for passing the variable to do it

I do not want to know all those page controllers What is the basis template in their context?

Thank you in advance!

Common features can be controlled in two ways.

  • Inheritance All page administrators are sub-classes of a common class that gives general properties.

  • Delegation All page controllers are part of a pipeline, where additional information is some normal procedure (before or after the page controller) times.

You have to choose one.


No comments:

Post a Comment