PHP + TinyButStrong Python replacement

pistacchio pistacchio at gmail.com
Wed May 7 09:40:29 EDT 2008


Diez B. Roggisch ha scritto:
> pistacchio wrote:
> 
>> Mike Driscoll ha scritto:
>>> On May 7, 6:12 am, pistacchio <pistacc... at gmail.com> wrote:
>>>> hi! i'm a php user and a python programmer. i'd love to use python for
>>>> my server side needs but i can't seem to find what i'm looking for. for
>>>> most of my php work i use mysql and tinyButStrong
>>>> (http://www.tinybutstrong.com) which is a very lightweight template
>>>> engine that offers powerful functionalities. you insert TBS tags in web
>>>> pages like:
>>>>
>>>> <div align="center" class="title-page"> [var.x] </div>
>>>>
>>>> and it replaces [var.x] with the value of global variable x. it also
>>>> makes blocks (and nested blocks) easy to implement:
>>>>
>>>> <p class="text-example2"> [blk1;block=begin] [blk1.val]<br>
>>>> [blk1;block=end] </p>
>>>>
>>>> in the previous code it cycles throu all the values of the array blk1.
>>>>
>>>> it does many more things, like htlm escaping, url and js encoding etc,
>>>> conditional displaying etc, but it is not more confusing that inserting
>>>> pieces of code into the HTML (aka: littering the code and kissing
>>>> goodbye to the code/presentation separation). it comes in the form of a
>>>> single file with a single class that you can easily include in the code
>>>> and go.
>>>>
>>>> now, i've searched the net and it seems full of python-based frameworks
>>>> for doing server side scripting and templating, but none that suits my
>>>> needs.
>>>>
>>>>     1. i like writing code and i like control. i mean, open up the
>>>> simplest text editor and write in it. i don't want something that is
>>>> command-line driven or that writes code for me like ">>>
>>>> makePagesFromThisDatabase()".
>>>>     2. i want something very lightweight. i don't want dozen of options,
>>>> pre-made blogging parts ecc. i just need a good non invasive template
>>>> engine and the basic functions for server side scripting, like session
>>>> managing, request parsing, functions to manipulate html code (encodings
>>>> etc)
>>>>     3. i don't want to beg my hosting provider to install the libraries.
>>>> a simple include file should do the work.
>>>>     4. object oriented programming is not required (better: i prefer
>>>> plain old procedural programming).
>>>>
>>>> any help? thanks in advance
>> hi, thanks for replaying
>>
>>> Did you look at TurboGears or Django? TG uses Kid in the 1.x series
>>> and Genshi in 2.x (I think) for templating purposes. There's also
>>> Cheetah, one of the more powerful Python templating engines out there.
>>>
>> django is exacly the kind of giant i'm trying to avoid
>>
>>> http://genshi.edgewall.org/
>> the first lines of the tutorial read:
>> "First, make sure you have CherryPy 3.0.x installed"
>> Now, cherrypy is something that is not properly "include a file and get
>> going!"
>>> http://www.kid-templating.org/
>> kid seems to have a non-linear approach, but i may give it a try
>>
>>> http://www.cheetahtemplate.org/
>> cheetah was something that i already considered using. have i to
>> "install" it or can i just import it?
> 
> You will need to install any of these. It is part of how python is designed.
> Extendability comes with a price-tag.
> 

well, the problema is exacly that i'm looking for a python module, not 
for a python library.
most of the tasks i need are just:
1. on the shoulders of the existing standard cgi modules, automate an 
render easier the handling of things such as sessions and requests
2. on the shoulders of the existing standard regex module, have a simple 
but complete templating engine and html-related encoder



More information about the Python-list mailing list