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 6 2009, 11:31 am
From: Steve <unetright.thebas...@xoxy.net>
Date: Sat, 6 Jun 2009 08:31:17 -0700 (PDT)
Local: Sat, Jun 6 2009 11:31 am
Subject: Re: pyTenjin Feature Requests
Makoto,

> > <html>
> >   <body>
> >     <ul>
> >       <?py if items: ?>
> >         <?py for item in items: ?>
> >           <li>#{item}</li>
> >         <?py #endfor ?>
> >       <?py #endif ?>
> >     </ul>
> >   </body>
> > </html>

> Yes, you can write in this style. There is no problem.

I have confirmed in my template that the above does work, and thank
you.  This get's me 80% of what I was looking for.  Is there anyway
your subclass technique might be modified to support the following:

<html>
  <body>
    <?py if bool1: ?>
      <div class="a">
        <div class="b">
          <p>
            text line A
            <?py if bool2: ?>
              text line B
            <? #endif bool2 ?>
            text line C
          </p>
        </div>
        <?py if bool3: ?>
          <p>
            text line D
          </p>
        <?py #endif bool3 ?>
      </div>
    <?py #endif bool1 ?>
  </body>
</html>

Notice in this example that bool2 and bool3 conditionals appear and
different indentations because of the structure of the html.  But in
python, they must appear at equal indentation levels.  Is there any
way to handle that?

> >   My only concern is that some
> > of the processing required to support #{@var} and the arbitrary
> > initial indentation of <?py ?> statemen

> Very little. Don't worry.
> This cost raised only when template compilation and
> no cost when template object is already cached.

You are correct I profiled my same template taking advantage of both
the more flexible <?py ?> indentation and the @var expansion.  This
uncached case showed approximately 1000 more function calls but the
resulting time increase was almost negligible.

You are correct that the additional cost would only be applicable when
not cached, however in a app engine environment, if you're not using
the gae memcache, the uncached case can be seen extremely frequently
because of the way GAE creates and tears down instances very often.

One other small note. In an earlier post I said I thought I could
easily build a simple whitespace compressor that would detect lines
with significant indentation.  I used the wrong character class.  It
should have been:
^\s*<?py"

Thank you again for all your help,
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.