Tim Valenta
tonightslastsong at gmail.com
Mon Mar 9 20:50:11 EDT 2009
Which is why I spoke on the matter myself:>> >> >>> Make sure you set the content type to text/html instead of what the >> >> >>> default is. I don't think mod_python is going to do that part for >> >> >>> you. >> >> >>> >> >> >>> http://www.modpython.org/pipermail/mod_python/2006-November/022587.html >> >> >>> Tim On Mon, Mar 9, 2009 at 6:46 PM, Graham Dumpleton <graham.dumpleton at gmail.com > wrote: > The danger in overriding the Apache default content type, rather than > having the Python code self contained, is that when you try and run > your application in a different Apache environment it will stop > working until you realise that you had changed something outside of > the actual Python code to get it to work. > > Thus, changing the default in Apache can be considered bad practice as > far as portability and maintainability of code. It certainly isn't > something you want to do if trying to develop a product which you > expect other people would want to install. > > So, by all means do it in your own environment if you want to, but > please don't suggest it is a good thing for others to do, it isn't. > > Graham > > 2009/3/10 Tim Valenta <tonightslastsong at gmail.com>: > > All I'm saying is that it's case-specific. If you never need to be > > rendering plain text, and you're handling your JS/CSS whatever on your > own, > > then great. > > And if you want plain text at times, then just throw a req.content_type = > > "text/html" in some basic header include file. The end. :) > > Tim > > On Mon, Mar 9, 2009 at 5:21 PM, Clodoaldo Pinto Neto > > <clodoaldo.pinto.neto at gmail.com> wrote: > >> > >> 2009/3/9 Tim Valenta <tonightslastsong at gmail.com>: > >> >> Do not override the default Apache content type as it will effect the > >> >> whole server. > >> > > >> > And if that's what you want, then it's just as well. Anything that > >> > isn't text/plain would have to specify its type, and that'd be no > >> > different than if it were text/html instead. > >> > >> Not sure I understand what you mean. Plain text is rendered > >> inconveniently by the browsers if the content type is text/html, like > >> it will use a fancy font, in instead of fixed, and will not respect > >> new lines making most kinds of texts, like code, much harder or next > >> to impossible to read. > >> > >> Regards, Clodoaldo > >> > >> > But if your server isn't just running this new project, then don't > >> > change it, as Graham said. If it's your own thing, then do whatever > >> > you want, with the future in mind :) > >> > > >> > Tim > >> > > >> > On Mon, Mar 9, 2009 at 4:45 PM, Graham Dumpleton > >> > <graham.dumpleton at gmail.com> wrote: > >> >> > >> >> 2009/3/10 Tim Valenta <tonightslastsong at gmail.com>: > >> >> > I know I still did. I haven't used psp. You could set your > default > >> >> > Apache > >> >> > content type to be 'text/html' if you want, and then you wouldn't > >> >> > have to do > >> >> > it manually each time. But whatever fits your situation is best. > >> >> > >> >> Do not override the default Apache content type as it will effect the > >> >> whole server. > >> >> > >> >> PSP handler should already set req.content_type to 'text/html'. > >> >> > >> >> The publisher handler will try and guess whether returned content is > >> >> text/html if not explicitly set. This guess isn't done though where > >> >> req.write() is used, only being done where response is returned as > >> >> string from publisher function. The guessing code tries to determine > >> >> if it is HTML by looking at last 100 characters of the response and > >> >> seeing if it matches regex: > >> >> > >> >> re_html = re.compile(r"</HTML\s*>\s*$",re.I) > >> >> > >> >> If for some reason the closing HTML tag is missing or badly formatted > >> >> it will not know it is HTML. > >> >> > >> >> The safest way is always to set req.content_type explicitly. > >> >> > >> >> Graham > >> >> > >> >> > Tim > >> >> > > >> >> > On Mon, Mar 9, 2009 at 4:09 PM, Jordan Dunn <jdunn at nodetwo.org> > >> >> > wrote: > >> >> >> > >> >> >> do you have to set that if your using publisher instead of psp? > >> >> >> > >> >> >> On Mon, Mar 9, 2009 at 4:52 PM, Tim Valenta > >> >> >> <tonightslastsong at gmail.com> > >> >> >> wrote: > >> >> >>> > >> >> >>> Make sure you set the content type to text/html instead of what > the > >> >> >>> default is. I don't think mod_python is going to do that part > for > >> >> >>> you. > >> >> >>> > >> >> >>> > http://www.modpython.org/pipermail/mod_python/2006-November/022587.html > >> >> >>> > >> >> >>> On Mon, Mar 9, 2009 at 3:42 PM, Graham Dumpleton > >> >> >>> <graham.dumpleton at gmail.com> wrote: > >> >> >>>> > >> >> >>>> 2009/3/10 Jordan Dunn <jdunn at nodetwo.org>: > >> >> >>>> > the only problem in having is that in IE7 it is printing the > >> >> >>>> > source > >> >> >>>> > instead > >> >> >>>> > of just the html. > >> >> >>>> > >> >> >>>> Unrelated. If you are having that problem you mustn't be > >> >> >>>> configuring > >> >> >>>> Apache correctly for your specific mod_python application. > >> >> >>>> > >> >> >>>> Please use reply-all and keep followups on the list. > >> >> >>>> > >> >> >>>> Graham > >> >> >>>> > >> >> >>>> > On Mon, Mar 9, 2009 at 4:30 PM, Graham Dumpleton > >> >> >>>> > <graham.dumpleton at gmail.com> wrote: > >> >> >>>> >> > >> >> >>>> >> Correct, it is effectively a warning only in this case. > Because > >> >> >>>> >> Windows uses a DLL for Python library it automatically picks > up > >> >> >>>> >> the > >> >> >>>> >> newer version. > >> >> >>>> >> > >> >> >>>> >> It would however be a problem on UNIX if mod_python had been > >> >> >>>> >> compiled > >> >> >>>> >> against a static Python library instead of a shared library. > >> >> >>>> >> > >> >> >>>> >> Graham > >> >> >>>> >> > >> >> >>>> >> 2009/3/10 Tim Valenta <tonightslastsong at gmail.com>: > >> >> >>>> >> > If I'm not mistaken, I think it still runs, right? It does > >> >> >>>> >> > give a > >> >> >>>> >> > warning, > >> >> >>>> >> > but that is because that version was compiled with Python > 2.5 > >> >> >>>> >> > (straight > >> >> >>>> >> > 2.5, > >> >> >>>> >> > not 2.5.2 or 2.5.4) > >> >> >>>> >> > I'm not sure if there's anything you'll be able to simply > >> >> >>>> >> > change to > >> >> >>>> >> > fix > >> >> >>>> >> > it. > >> >> >>>> >> > It shouldn't have any problems though. (At least, I > haven't > >> >> >>>> >> > experienced > >> >> >>>> >> > any.) > >> >> >>>> >> > Tim > >> >> >>>> >> > > >> >> >>>> >> > 2009/3/9 Jordan Dunn <jdunn at nodetwo.org> > >> >> >>>> >> >> > >> >> >>>> >> >> i installed apache2.2 and python 2.5.4, and when i > installed > >> >> >>>> >> >> mod_python > >> >> >>>> >> >> it > >> >> >>>> >> >> installed fine, but in the apache logs it says its looking > >> >> >>>> >> >> for 2.5 > >> >> >>>> >> >> instead > >> >> >>>> >> >> of 2.5.4? how can i fix this? > >> >> >>>> >> >> _______________________________________________ > >> >> >>>> >> >> Mod_python mailing list > >> >> >>>> >> >> Mod_python at modpython.org > >> >> >>>> >> >> http://mailman.modpython.org/mailman/listinfo/mod_python > >> >> >>>> >> >> > >> >> >>>> >> > > >> >> >>>> >> > > >> >> >>>> >> > > >> >> >>>> >> > -- > >> >> >>>> >> > "If you had a katana, ..." > >> >> >>>> >> > Party like it's 1234567890 > >> >> >>>> >> > > >> >> >>>> >> > _______________________________________________ > >> >> >>>> >> > Mod_python mailing list > >> >> >>>> >> > Mod_python at modpython.org > >> >> >>>> >> > http://mailman.modpython.org/mailman/listinfo/mod_python > >> >> >>>> >> > > >> >> >>>> >> > > >> >> >>>> > > >> >> >>>> > > >> >> >>>> > >> >> >>>> _______________________________________________ > >> >> >>>> Mod_python mailing list > >> >> >>>> Mod_python at modpython.org > >> >> >>>> http://mailman.modpython.org/mailman/listinfo/mod_python > >> >> >>> > >> >> >>> > >> >> >>> > >> >> >>> -- > >> >> >>> "If you had a katana, ..." > >> >> >>> Party like it's 1234567890 > >> >> >> > >> >> > > >> >> > > >> >> > > >> >> > -- > >> >> > "If you had a katana, ..." > >> >> > Party like it's 1234567890 > >> >> > > >> > > >> > > >> > > >> > -- > >> > "If you had a katana, ..." > >> > Party like it's 1234567890 > >> > > >> > _______________________________________________ > >> > Mod_python mailing list > >> > Mod_python at modpython.org > >> > http://mailman.modpython.org/mailman/listinfo/mod_python > >> > > > > > > > > > -- > > "If you had a katana, ..." > > Party like it's 1234567890 > > > -- "If you had a katana, ..." Party like it's 1234567890 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20090309/bb7ecee8/attachment.html
|