Python embedded like PHP

Magnus Lyckå magnus at thinkware.se
Wed Mar 20 08:34:40 EST 2002


> Andy Gimblett <gimbo at ftech.net> writes:
>><ul tal:define="sequence python:container.mydb.selectbyname(name='peter')">
>>  <li tal:repeat="item sequence">
>>    <span tal:replace="item/surname">surname</span>
>>  </li>
>></ul>


Paul Rubin wrote:

> Geez, I find all this pseudo-HTML horrendous.  Why not just embed
> normal looking code in <?  ?> tags the way PHP does it?  Do WYSIWYG
> editors have a problem with that?  If worse comes to worse, embed
> the Python code with the kinds of tags used for Javascript.  The
> WYSIWYG editors should be used to Javascript by now.
 
Well Paul, this is actually rather clever, particularly

where the labour is divided between someone who produces
layout and text, and someone else who writes the code.

If someone has written the HTML with just mock-up values where
there should be data from the application you just add the
attributes to replace the tag contents with program generated
data.

The HTML will display the same. You can look at the file in
a browser or in deramweaver etc, and you will see the correct
layout with the mock-up values.

Run it in your application and you will see real data instead.

With the PHP approach, the "visual designer" won't be able to

see what the page will actually look like in his HTML editor.
No way. He will have to guess, and upload it into the application
and run it there to see if the visual appearence was the way he
wanted.

Sure, the data from the application might look fairly different
from his mock-up data. In the example above he'll only see one
list element, and in reality there might be many. It's still
much closer to WYSIWYG than any other approach I've seen though.


Even if you are the one and the same, it will probably be simpler

to get the design right with this approach.





More information about the Python-list mailing list