Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion pyTenjin Feature Requests
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Steve  
View profile  
 More options Jun 5 2009, 2:37 pm
From: Steve <unetright.thebas...@xoxy.net>
Date: Fri, 5 Jun 2009 11:37:17 -0700 (PDT)
Local: Fri, Jun 5 2009 2:37 pm
Subject: pyTenjin Feature Requests
Hi,

I've been working over the past couple days to port my Google App
Engine website from using the built-in django template system to
using  pyTenjin.  The porting has been difficult primarily because my
django based templates use extensively inline conditionals, like:

<div id="chart">{% if not use_swf  %}<img src="{{ img_src }}"
alt="chart">{% endif %}</div>

I think getting inline conditionals in Tenjin is too much to hope
for.  My first feature request though is to allow Tenjin <?py
statement ?> tags to ignore initial indentation as long as they are
consistently indented.  For example, now in my html template I must do
this:

<body>
    <div>
        <p>
<?py if boolean: ?>
                some conditional text
<?py #endif ?>
        </p>
    </div>
</body>

The indentation levels of the <?py ?> statements are mandatory to be
separate from my indentation of the html content.  Instead, I would
like to be able to use whatever indentation is appropriate for the
html as long as it is constant between <?py ?> statements.  For
example:

<body>
    <div>
        <p>
            <?py if boolean: ?>
                some conditional text
            <?py #endif ?>
        </p>
    </div>
</body>

This would make pyTenjin statements similar to Mako's control
structures ( http://www.makotemplates.org/docs/syntax.html#syntax_control
) and python blocks ( http://www.makotemplates.org/docs/syntax.html#syntax_python
).

Another problem I have is that my django templates get pre-processed
with an html compressor which strips out redundant whitespace.  Since
I indent my html liberally and use 4 spaces per indentation, there is
a 30% reduction with this processing.  Yes I do know this is minimized
with html gzip transfer encoding.  Howerver some browsers ( *cough* IE
*cough* ) have caching and etag bugs with respect to gzip'd content.

Anyway, since I lose the ability to easily strip whitespace with
Tenjin (because <?py ?> statement indentation is significant) I am
trying to reduce some of my whitespace.  I would like to be able to do
the following:

<?py if boolean: ?>one set of <strong>important</strong> text
<?py else: ?>one set of <em>other</em> text
<? #endif ?>final unconditional text

Right now (pyTenjin 0.7) the first two lines work as expected.
However the text after the <? #endif ?> does not get output to the
html stream.  I think making it work after any <?py ?> tag would be
nice for consistency. And I think it would be as easy as automatically
adding a \n newline to the stream after parsing any ?> closing mark.
The only place that might be too simplistic would be inside <pre>
blocks.

Preliminary benchmarks show pyTenjin to compare extremely favorably to
the GAE built-in django templates.  I have several inline conditionals
to try to translate to Tenjin helper functions.  After that I will be
sure to post some concrete performance numbers.

Thank you for your work on this viable templating system.

Regards,
Steve


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.