[mod_python] psp include syntax

Emlyn Jones emlynj at gmail.com
Fri Feb 24 10:10:00 EST 2006

> On Fri, 2006-02-24 at 13:51 +0000, Emlyn Jones wrote:
> > Hello,
> > I've written a web app which uses mod_python on Apache. I now need to
> > make it work using Python/ASP and IIS (using Mr Hammonds excellent
> > Python Win32 package) so I've wrapped everything up into a
> > ServerObject hiding the underlying implementation and making my pages
> > "pure" python. The only remaining problem is including other files. As
> > you know the include directive for mod_python is this:
> >
> > <%@ include file="scriptheader.asp"%>
> >
> > Where as for IIS/ASP it is this:
> >
> > <!--#include file ="scriptheader.asp"-->
> >
> > IIS barfs at the mod_python syntax and mod_python ignores the IIS
> > syntax. Other than hacking the mod_python source code, can anybody
> > think of a nifty way to make the includes work on either platform?
> > (I realise this may be an impossible dream, but you never know).
> >
> > Cheers,
> > Emlyn.
> >
On 2/24/06, Joshua Ginsberg <listspam at flowtheory.net> wrote:
> (whoops -- forgot to CC the list... :-/ )
Me too.
> Howdy Emlyn --
> While I'm sure it's a perfectly valid technical term I'm unaware of
> since I don't ever work on Windows systems, could you provide a little
> more insight to us *nix folk what "barfs" means? :-)
> -jag
He He, Yes, your right. Sorry.
IIS/ASP complains because and line starting with <%@ has to be the
first line in the script. It's expecting it to be <%@
Language=Python%> (or vbscript or what ever).
Sorry for the colloquial term. "barf" is about as technical as I get
on a Windows system. I just turn it off when it doesn't do what I want
it to and switch back to my Debian box. This time unfortunatly, I
can't. The reason I posted here rather than a Windows/IIS type list is
because I think there is probably more flexibility in mod_python than
there is in IIS/ASP.
Unless there is some kind of magic config setting, I'm thinking I'll
need some kind of pre processing of the script to turn:
<!--#include file ="scriptheader.asp"-->
<%@ include file="scriptheader.asp"%>
Which I currently do offline with a small Python script. It would be
nice to be able to do it "live" though then I can drop the same code
on either server and it will "just work".


More information about the Mod_python mailing list