Edgewall Software

Changes between Version 6 and Version 7 of GSoC2008


Ignore:
Timestamp:
Jun 30, 2008, 4:01:29 PM (16 years ago)
Author:
mkurczych
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GSoC2008

    v6 v7  
    1818Also common situation is when there are only few possible variable values - for example only True or False. We can pre-reder parts of code for each of values and use them later. We only have to check for given fragment of template which values does it use and find recurrences of this values.
    1919There's also need of making filters compatible with this changes - probably somehow mark fragment of code they change.
     20
     21Sometimes template creator will have to think about optimizations while creating template. For example in following code:
     22
     23{{{
     24<a href="/edit/1" py:if="user.autorized()">[edit]</a>
     25<p>1111 11 11</p>
     26<a href="/edit/2" py:if="user.autorized()">[edit]</a>
     27<p>222 22 22 2</p>
     28<a href="/edit/3" py:if="user.autorized()">[edit]</a>
     29<p>333 33333 33 333</p>
     30}}}
     31The variable here is user. Creating pre-render dict user -> pre-rendered paragraph wont't help a lot, because there will be a lot of users. But this code can be also written as:
     32{{{
     33<py:with vars="a = user.authorized()">
     34<a href="/edit/1" py:if="a">[edit]</a>
     35<p>1111 11 11</p>
     36<a href="/edit/2" py:if="a">[edit]</a>
     37<p>222 22 22 2</p>
     38<a href="/edit/3" py:if="a">[edit]</a>
     39<p>333 33333 33 333</p>
     40</py:with>
     41}}}
     42Now fragment depends only on variable "a", which can be only True or False, which gives optimization possibilities.