[Tutor] path in BaseHttpServer.py module

Kirk Bailey idiot1 at netzero.net
Sun Sep 28 12:20:50 EDT 2003


Apparently BaseHTTPServer.py module defines self.path as path from the command 
line. relevant exerpt:
         requestline = self.raw_requestline
         if requestline[-2:] == '\r\n':
             requestline = requestline[:-2]
         elif requestline[-1:] == '\n':
             requestline = requestline[:-1]
         self.requestline = requestline
         words = requestline.split()
         if len(words) == 3:
             [command, path, version] = words
(line 224-232)
  self.command, self.path, self.request_version = command, path, version
(line 245)

OKFINE. But I want the server script to referr to a directory UNDER that point 
on the tree, so webpages (in fact all of the web accessable tree) is rooted in a 
directory UNDER that directory. This means modifying the path declaration in the 
module- which means editing the module, OR declaring it in the top level script. 
Now this gets back to how python works, espically how it handles building up 
it's dictionary when it imports functions in modules. If I redefine a function 
defined in an imported module, will this break other functions?

Again, the existing script is:
#!C:\Python22\pythonw.exe
# COPYRIGHT 2003 Steve Holden, free for personal use.
# Please visit http://www.holdenweb.com/ to learn more!
#
import CGIHTTPServer, BaseHTTPServer
httpd=BaseHTTPServer.HTTPServer(('',8080), CGIHTTPServer.CGIHTTPRequestHandler)
httpd.serve_forever()
#

Any discussion?

-- 

-- 

end

Cheers!
         Kirk D Bailey

  +                              think                                +
   http://www.howlermonkey.net  +-----+        http://www.tinylist.org
   http://www.listville.net     | BOX |  http://www.sacredelectron.org
   Thou art free"-ERIS          +-----+     'Got a light?'-Prometheus
  +                              kniht                                +

Fnord.





More information about the Tutor mailing list