python in dreamweaver
Josiah Carlson
jcarlson at nospam.uci.edu
Sat Jan 31 02:20:00 EST 2004
>>>>It would be significantly more Pythonic to have a template similar to
>
> the following...
>
> Yes, but there are the visual aspect of DM...
>
>
> MCI
So do your templates in Dreamweaver, and read them in with python during
runtime. All I'm saying is that:
>>> template = template.replace('REPLACE_THIS_WITH_MENU', menu)
.
.
.
>>> template = template.replace('REPLACE_THIS_WITH_CONTENT', content)
is not pythonic, but using standard python string formatting options:
>>> output = template%{'menu':menu, 'content':content}
is not only pythonic, it is faster for large numbers of insertions, and
is much easier to extend.
- Josiah
More information about the Python-list
mailing list