FAQ
I wrote something called PajamaScript. Basically, it parses a text
file and looks for <pj> tags. Then it calls python to handle the
scripting. Why learn another language when you already know Python?

<html>
<head>
<title>This is fun!</title>
</head>
<body>
The Date is <pj module="misc" function="zdate" / >.<br>
The Time is <pj module="misc" function="ztime" / >.<p>

<pj module="database" function="generateTableOfResults" / >
</body>
</html>

PajamaScript then calls the function "zdate" in module "misc" and the
output replaces the tag. This is not really tested in any production
system, just a proof of concept I did for a project that never
materialized. In order to access cgi variables, you can use the cgi
module or any other python module! Would this be useful to anyone?

Search Discussions

  • Eric Pederson at Dec 6, 2004 at 1:57 am

    Jerome (aka evil tofu) advised:

    I wrote something called PajamaScript. Basically, it parses a text
    file and looks for <pj> tags. Then it calls python to handle the
    scripting. Why learn another language when you already know Python?

    <html>
    <head>
    <title>This is fun!</title>
    </head>
    <body>
    The Date is <pj module="misc" function="zdate" / >.<br>
    The Time is <pj module="misc" function="ztime" / >.<p>

    <pj module="database" function="generateTableOfResults" / >
    </body>
    </html>

    PajamaScript then calls the function "zdate" in module "misc" and the
    output replaces the tag. This is not really tested in any production
    system, just a proof of concept I did for a project that never
    materialized. In order to access cgi variables, you can use the cgi
    module or any other python module! Would this be useful to anyone?

    Every tool has a use! Offhand it occurs to me this might a simple, well organized structure for a cgi environment, though I wonder if the extra level of processing might make it a little slow. Ought to be other uses too...

    I _do_ think the <pj> tags and the title "PajamaScript" is brilliant marketing. Highest kudos!


    ["PajamaScript" beats "PyTxtParse2ModuleExecEnviron.py" !]

    Any functioning examples of its use?



    Eric Pederson
    :::::::::::::::::::::::::::::::::::
    def eAddy():
    domainNot="@something.com"
    domainIs=domainNot.replace("s","z")
    ePrefix="".join([chr(ord(x)+1) for x in "do"])
    mailMeAt=ePrefix+domainIs
    return mailMeAt
    :::::::::::::::::::::::::::::::::::
  • Roger Binns at Dec 6, 2004 at 2:51 am
    "Jerome Chan" <eviltofu at gmail.com> wrote in message news:c312d08f.0412051603.622b3315 at posting.google.com...
    I wrote something called PajamaScript. Basically, it parses a text
    file and looks for <pj> tags. Then it calls python to handle the
    scripting. Why learn another language when you already know Python?
    Why write another templating tool, when there are so many already
    (other than as a valuable learning exercise). Check out the
    Python Cookbook:

    http://aspn.activestate.com/ASPN/Python/Cookbook/

    It has several. Here are the best:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52217
    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/162292

    Note that they also deal with the area you will have an issue
    in which is how to add conditional statements.

    Roger

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedDec 6, '04 at 12:03a
activeDec 6, '04 at 2:51a
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase