[mod_python] Re: My .py won't some up for the blient

Bradley Hintze bradley.h at aggiemail.usu.edu
Thu Jun 24 10:06:49 EDT 2010


Ok. I re-wrote my destroy_confirm.py script and got the right output
to the client but it seems my styl sheets don't work. when I take the
exact string that I'm returning and save it in an HTML file the style
sheets work. Any ideas why my .py script won't implement my css?

Here is my new destroy_confirm.py;

import HTML_template

def middle():

    mid='''\
<center>
<table width = 550 cellpadding = 10 bgcolor=white>
<tr><td><center>This action will delete all your session files.
<tr><td><center>
<form  action="destroy_LogOut.psp" method="">
<center><input type="submit" value="Run MolProbity Compare"></center>'''

    return mid

def show():
    html_all = HTML_template.start() + middle() + HTML_template.end()
    return html_all



Thanks,
Bradley

On Thu, Jun 24, 2010 at 9:37 AM, Bradley Hintze
<bradley.h at aggiemail.usu.edu> wrote:
> Hi all,
>
> Newbie question. I was hoping to have template HTML at the beginning
> of my .py script and the end. I can't get it to work. Here is what I
> have.
>
> destroy_confirm.py =
>
> import HTML_template
> HTML_template.start()
> '''\
>  <center>
>  <table width = 550 cellpadding = 10 bgcolor=white>
>    <tr><td><center>This action will delete all your session files.
>    <tr><td><center>
>        <form  action="destroy_LogOut.psp" method="">
>        <center><input type="submit" value="Run MolProbity Compare"></center>'''
> HTML_template.end()
>
>
> HTML_template.py =
>
> def start():
>    start= '''\
> <html>
> <head>
> <link rel="stylesheet" type="text/css" href="style.css" />
> </head>
> <body>
>  <center>
>  <table width = 1024 cellpadding = 10>
>    <tr><td valign = top>Molprobity Compare<br /><br /><br />
>                    <a href ="destroy_confirm.psp">Log Off</a>
>        <td>
>            <table width = 850 cellpadding = 10>
>                <tr><td colspan = 2><center><h1>MolProbity Compare</h1></center>
>                <tr><td colspan = 2>Molprbity Compare will allow you
> to compare Molprobity parameters
>                    for two different structures. The program will
> highlghit important
>                    differences between the two.
>            </table>
>  <hr>
> '''
>    return start
>
> def end():
>    end = '''\
>  </table>
>  </center>
> </body>
> </html>
> '''
>    return end
>
>
> Handlers in httpd.conf  =
>
> <Directory /Library/WebServer/Documents>
>    AddHandler mod_python .py .psp .psp_
>    <FilesMatch "\.(psp|psp_)$">
>        PythonHandler mod_python.psp
>        </FilesMatch>
>        <Files *.py>
>        PythonHandler mod_python.publisher
>        </Files>
>    PythonDebug On
> </Directory>
>
> I hope this isn't too much to ask.  Any ideas?
>
> --
> Bradley J. Hintze
> Graduate Student
> Duke University
> School of Medicine
> 801-712-8799
>



-- 
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799



More information about the Mod_python mailing list