ANN: empy 1.1 -- Embed Python in template text as markup

Erik Max Francis max at
Mon Aug 5 19:14:52 EDT 2002

Will Stuyvesant wrote:

> This is a huge project you have!  The sample.mpy did work allright
> here.
> I think this is a very nice project, it reminds me of (commercial)
> work I used to do with PROGRESS and ORACLE, they were for extracting
> information from databases and mixing the data with text.

Right.  The basic idea is when you have a script that uses Python, but
which consists of more text than Python code.

> You could
> do this with your empy module of course since you can have the python
> code in @{ ... }@ open a database and do queries (based on command
> line params?!).

Command line parameters are a possibility, although you could pass them
in with bindings through the command line -E facility: -E 'args = [1, 2, "hello"]' yourscript.em

I'm not sure what ramifications being able to pass command line
arguments in would have, or even what they would look like (since
multiple empy files can be specified on the command line).

> Maybe you could give more 'dedicated' examples or maybe a description
> what you do use it all for.  For example how to write your own HTML
> webpage macro thing or couplings with local files with tables with
> data, transforming financial data to nota's, agenda's, etc.

Yes, that's a good idea; it needs more examples.  I'm still in the
process of converting my (many) sites which used m4 for the same purpose
to empy.  Here's a description of the process I use for my Web sites
(although still in m4 for some):

The later projects use Python instead of Perl for the cataloguing
process, build databases, and then prepare include files for m4 ... at
which point, the obvious question became, "Why don't I just do this all
in Python -- cataloguing, database building, and then template
processing?"  That's how empy was born.  (That's also why empy supports
m4-style diversions ...)

Thanks for your comments.

 Erik Max Francis / max at /
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ See the son in your bad day / Smell the flowers in the valley
\__/ Chante Moore Aliens vs. Predator 2 /
 A personal guide to Aliens vs. Predator 2.

More information about the Python-list mailing list