Sean Davis
sdavis2 at mail.nih.gov
Fri Oct 20 19:21:57 EDT 2006
ecastro1981-misc at yahoo.com wrote: > Hi, > > Sorry I am a newbie. I have been testing out the following example > from the CSS wikipedia article but I do not get the same output as > displayed in wikipedia. As an actual xml file with a css page it works > but I think I am doing something wrong with the modpython handlers. > > http://en.wikipedia.org/wiki/Cascading_Style_Sheets > > my file is test.py > =========================== > from mod_python import apache > > def say(req, what="NOTHING"): > return "I am saying %s" % what > > def test4(req): > req.content_type = 'text/xml; charset=UTF-8' > req.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") > req.write("<?xml-stylesheet type=\"text/css\" href=\"C:\Program > Files\Apache Software Foundation\Apache2.2\htdocs\css.css\"?>") > req.write("<schedule>") > req.write("<date>Tuesday 20 June</date>") > req.write("<programme>") > req.write("<starts>6:00</starts>") > req.write("<title>News</title>") > req.write("With Michael Smith and Fiona Tolstoy.") > req.write("Followed by Weather with Malcolm Stott.") > req.write("</programme>") > req.write("<programme>") > req.write("<starts>6:30</starts>") > req.write("<title>Regional news update</title>") > req.write("Local news for your area.") > req.write("</programme>") > req.write("<programme>") > req.write("<starts>7:00</starts>") > req.write("<title>Unlikely suspect</title>") > req.write("Whimsical romantic crime drama starring Janet") > req.write("Hawthorne and Percy Trumpp.") > req.write("</programme>") > req.write("</schedule>") > return > > > def test5(req): > req.content_type = 'text/xml; charset=UTF-8' > req.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") > req.write("<?xml-stylesheet type=\"text/css\" href=\"css.css\"?>") > req.write("<schedule>") > req.write("<date>Tuesday 20 June</date>") > req.write("<programme>") > req.write("<starts>6:00</starts>") > req.write("<title>News</title>") > req.write("With Michael Smith and Fiona Tolstoy.") > req.write("Followed by Weather with Malcolm Stott.") > req.write("</programme>") > req.write("<programme>") > req.write("<starts>6:30</starts>") > req.write("<title>Regional news update</title>") > req.write("Local news for your area.") > req.write("</programme>") > req.write("<programme>") > req.write("<starts>7:00</starts>") > req.write("<title>Unlikely suspect</title>") > req.write("Whimsical romantic crime drama starring Janet") > req.write("Hawthorne and Percy Trumpp.") > req.write("</programme>") > req.write("</schedule>") > return > > > I was hoping a call to test4 or test5 would pickup the css file but > nothing happened. Does my apache conf file need something else. I > strongly suspect I need to declare some directory in my apache conf > file, but I am stuck. Did you install mod_python? Did you configure it in apache? Did you add a directive to direct mod_python to handle the directory? Does a test from the mod_python manual work? What do you have in yor apache configuration for this file? What do you type into the address bar of the browser? What are the results? If they are not what you expect, what does you error log show? Also, content handlers need to return apache.OK (or at least some apache constant). In short, some more specifics might be needed here. Sean
|