[mod_python] mod_python and css

Kevin Ballard kevin at sb.org
Wed Dec 31 15:18:58 EST 2003


That's because with this handler, your URL looks something like

http://my.domain.com/myScript/mostrar

so when you access "estilo.css", the requested URL is

/myScript/estilo.css

However, your script doesn't handle estilo.css, since that's actually a 
file in the same directory as myScript. If you replace the script with 
mostrar.html, then estilo.css is accessed as

/estilo.css

instead, since the myScript path segment is now gone.

The solution is to put "../estilo.css" as your CSS href.

P.S. Why does this list use a Reply-To for the original sender rather 
than for the list itself? I keep sending mail to individual people when 
I mean to simply reply to the list itself.

On Dec 31, 2003, at 4:57 AM, Red Conecta wrote:

> I'm trying to use css with the publisherhandler; here is the code:
>
>    def _inicio():
>        ini= '''<head><title>nombredelsitio</title>
>                  <link rel="stylesheet" href="estilo.css"
>    Type="text/css"></head>
>                  <body leftmargin=0 rightmargin=0 topmargin=0
>    bottommargin=0>'''
>              return ini
>
>    def _final():
>        return '</body></html>'
>
>    def mostrar(req,direccion='/'):
>        req.content_type = "text/html"
>        html=_inicio()
>        obj=leerobjeto(direccion)
>        if obj!=None:
>            for i in obj.__dict__:html+=i+': '+obj.__dict__[i]+'<br>'
>        else:html+='error'
>        html+=_final()
>        return html
>
> the output doesn't use the estilo.css archive but if I save the page 
> in 'mostrar.html' all is ok.

-- 
Kevin Ballard
kevin at sb.org
http://www.tildesoft.com
http://kevin.sb.org



More information about the Mod_python mailing list