"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/dev_guide/design.rst" between
cheetah3-3.1.0.tar.gz and cheetah3-3.2.0.tar.gz

About: Cheetah3 is a template engine and code generation tool for e.g. for Web development or Java, SQL, LaTeX, form email ... (written in Python).

design.rst  (cheetah3-3.1.0):design.rst  (cheetah3-3.2.0)
Design Decisions and Tradeoffs Design Decisions and Tradeoffs
============================== ==============================
(design)
Delimiters Delimiters
---------- ----------
(design.Delimiters)
One of the first decisions we encountered was which delimiter One of the first decisions we encountered was which delimiter
syntax to use. We decided to follow Velocity's {$placeholder} and syntax to use. We decided to follow Velocity's {$placeholder} and
{#directive} syntax because the former is widely used in other {#directive} syntax because the former is widely used in other
languages for the same purpose, and the latter stands out in an languages for the same purpose, and the latter stands out in an
HTML or text document. We also implemented the HTML or text document. We also implemented the
``${longPlaceholder}`` syntax like the shells for cases where ``${longPlaceholder}`` syntax like the shells for cases where
Cheetah or you might be confused where a placeholder ends. Tavis Cheetah or you might be confused where a placeholder ends. Tavis
went ahead and made ``${longPlaceholder}`` and went ahead and made ``${longPlaceholder}`` and
``$[longPlaceholder]`` interchangeable with it since it was trivial ``$[longPlaceholder]`` interchangeable with it since it was trivial
to implement. Finally, the {#compiler} directive allows you to to implement. Finally, the {#compiler} directive allows you to
skipping to change at line 44 skipping to change at line 40
to see in a visual editor (supposedly), but in text editors they're to see in a visual editor (supposedly), but in text editors they're
hard to distinguish from "real" HTML tags unless you look closely, hard to distinguish from "real" HTML tags unless you look closely,
and they're many more keystrokes to type. Also, if you make a and they're many more keystrokes to type. Also, if you make a
mistake, the tag will show up as literal text in the rendered HTML mistake, the tag will show up as literal text in the rendered HTML
page where it will be easy to notice and eradicate, rather than page where it will be easy to notice and eradicate, rather than
disappearing as bogus HTML tags do in browsers. disappearing as bogus HTML tags do in browsers.
Late binding Late binding
------------ ------------
(design.lateBinding)
One of Cheetah's unique features is the name mapper, which lets you One of Cheetah's unique features is the name mapper, which lets you
write {$a.b} without worrying much about the type of {a} or {b}. write {$a.b} without worrying much about the type of {a} or {b}.
Prior to version 0.9.7, Cheetah did the entire NameMapper lookup at Prior to version 0.9.7, Cheetah did the entire NameMapper lookup at
runtime. This provided maximum flexibility at the expense of speed. runtime. This provided maximum flexibility at the expense of speed.
Doing a NameMapper lookup is intrinsically more expensive than an Doing a NameMapper lookup is intrinsically more expensive than an
ordinary Python expression because Cheetah has to decide what type ordinary Python expression because Cheetah has to decide what type
of container {a} is, whether the the value is a function (autocall of container {a} is, whether the the value is a function (autocall
it), issue the appropriate Python incantation to look up {b} in it, it), issue the appropriate Python incantation to look up {b} in it,
autocall again if necessary, and then convert the result to a autocall again if necessary, and then convert the result to a
string. string.
skipping to change at line 92 skipping to change at line 86
whether it exists. This allows users to create {a} or change its whether it exists. This allows users to create {a} or change its
type anytime before a template filling. type anytime before a template filling.
The lesson we learned is that it's better to decide what you want The lesson we learned is that it's better to decide what you want
and then figure out how to do it, rather than assuming that certain and then figure out how to do it, rather than assuming that certain
goals are unattainable due to performance considerations. goals are unattainable due to performance considerations.
Caching framework Caching framework
----------------- -----------------
(design.cache)
Webware compatibility and the transaction framework Webware compatibility and the transaction framework
--------------------------------------------------- ---------------------------------------------------
(design.webware)
Single inheritance Single inheritance
------------------ ------------------
(design.singleInheritance)
 End of changes. 6 change blocks. 
10 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)