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 16 2009, 8:24 pm
From: Steve <unetright.thebas...@xoxy.net>
Date: Tue, 16 Jun 2009 17:24:25 -0700 (PDT)
Local: Tues, Jun 16 2009 8:24 pm
Subject: Re: pyTenjin Feature Requests
Thank you very much!  It will take me several days to try to
understand this.  Currently I am trying to migrate my data to a new
schema and then I will be able to upgrade to the latest pyTenjin
release.  And then I'll have some time to test this new template
class.  It looks really good.

Thanks,
Steve

On Jun 13, 9:07 am, makoto kuwata <kwa...@gmail.com> wrote:

> Hi Steve,

> I wrote my_template.py which parses template recogniginz
> '#endfor', '#endif', and so on.

> http://gist.github.com/129297

> ex.pyhtml:

>     <html>
>       <body>
>       <?py if items: ?>
>         <table>
>         <?py i = 0 ?>
>         <?py for item in items: ?>
>         <?py   i += 1 ?>
>         <?py   klass = i % 2 and 'odd' or 'even' ?>
>           <tr class="#{klass}">
>             <td>#{i}</li>
>             <td>${item}</li>
>           </tr>
>         <?py else: ?>
>           <p>nothing.</p>
>         <?py #endfor ?>
>         </table>
>       <?py else: ?>
>         <p>Not found.</p>
>       <?py #endif ?>
>       </body>
>     </html>

> example:

>     import tenjin
>     from tenjin.helpers import *
>     from my_template import MyTemplate
>     engine = tenjin.Engine(templateclass=MyTemplate, cache=False)
>     print(engine.get_template("ex.pyhtml").script)

> output:

>     _buf.extend(('''<html>
>       <body>\n''', ));
>     if items:
>         _buf.extend(('''    <table>\n''', ));
>         i = 0
>         for item in items:
>             i += 1
>             klass = i % 2 and 'odd' or 'even'
>             _buf.extend(('''      <tr class="''', to_str(klass), '''">
>             <td>''', to_str(i), '''</li>
>             <td>''', escape(to_str(item)), '''</li>
>           </tr>\n''', ));
>         else:
>             _buf.extend(('''      <p>nothing.</p>\n''', ));
>         #endfor
>         _buf.extend(('''    </table>\n''', ));
>     else:
>         _buf.extend(('''    <p>Not found.</p>\n''', ));
>     #endif
>     _buf.extend(('''  </body>
>     </html>\n''', ));

> This is an example and not tested enough.
> If you found any bugs, let me know.

> --
> regards,
> makoto kuwata


 
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.