Ann: PMZ - Poor Man's Zope
Andreas Jung
ajung at sz-sb.de
Thu Feb 3 14:42:30 EST 2000
On Thu, Feb 03, 2000 at 04:13:52PM +0000, rdudfield at my-deja.com wrote:
> In article
> <Pine.LNX.3.96.1000202132043.6280A-100000 at starship.skyport.net>,
> Andreas Jung <ajung at starship.skyport.net> wrote:
> > Dear all,
> >
> > I am happy to announce the availability of POOR MAN'S ZOPE 0.1.
> >
> > PMZ is very similar to Active Server Pages or PHP3/4 and allows you
> > to include Python code into your HTML pages.
> >
>
> Heh this is funny.
>
> I just found your old code a week or two ago, and changed it to parse
> for python code on multiple lines as well. I got rid of the cgi and
> restricted execution stuff as the imports were taking alot of the time
> at start up ( and I don't need them unlike alot of people I'm sure ).
>
> I also used <py> </py> as the tags instead of <? ?>.
>
> Noticed in your docs you said it might be faster as an apache module...
> I don't think it would for most files, as the main slow down would be in
> starting up python, and since your going to be executing python
> anyway...
>
>
> Another extention to your script that I was thinking of making is the
> following:
>
> Have a string which the stuff html get put into instead of printing it.
> If there is a problem with your python code, then have another function
> serve up some other text. You could define a function that gets called
> if an exception is raised or some other error occurs.
>
> You would of course have to make your python code concat stuff on to the
> end of this string instead of printing it.
>
> Anyway just something I need in my case.
>
> Also I found a myerrorprint handy. Like your myprint, but it writes to
> stderr instead, which you can read in the apache error log file.
>
>
> One more thing.
>
> If you could add the idea of having templates, like in some other python
> code that would be great. The problem I have with the other template
> code is that it can not be read by wysiwyg html editors.
>
> So I think the following scheme would be good.
>
> Have a list. Lets call it _pmz_listOhtmlBits.
>
> Now we have some new invented tags called <pyt> </pyt> Short for python
> template.
>
> Then you can code in your html:
>
> <pyt>
> This is the first part of my conditionally served html.
> bla blab bla <b> bla! </b>.
> </pyt>
>
> <pyt>
> This is the second part of my conditionally served html.
> dum de dum <b> dum de dum! </b>.
> </pyt>
>
> When the code is parsed we have _pmz_listOhtmlBits with these two bits
> of html as elements. Which we can then place into the html doc with our
> python code.
>
>
> One more thing before I go. If you put a long piece of python code into
> a module instead of straight into the html, then you can get a speed up,
> and it looks nicer. <py> import doStuff </py>
>
Thanks for your suggestions. The current version is a rewrite
and code cleanup of the one year old version - it's much
more pretty now. I'll think about your ideas. May be the next
version will follow soon.
Andreas
More information about the Python-list
mailing list