=== modified file 'THANKS'
--- THANKS	2007-03-09 11:09:14 +0000
+++ THANKS	2007-03-10 13:33:38 +0000
@@ -1,2 +1,2 @@
 Sam Ruby             - Inspiration
-Joe Gregori          - Python CGI outline example (sparklines)
+Joe Gregorio         - Python CGI outline example (sparklines)

=== modified file 'bzr-feed.py'
--- bzr-feed.py	2007-03-09 11:09:14 +0000
+++ bzr-feed.py	2007-03-10 13:47:32 +0000
@@ -25,14 +25,14 @@
         self.branch = branch
         self.feedid = baseuri.replace('http://', 'tag:').replace('/', "," + time.strftime("%Y-%m-%d",time.gmtime(created)) + ":", 1)
 
-        print "Content-Type: application/atom+xml"
-        print
+        if os.environ.get('SCRIPT_NAME',None):
+            print "Content-Type: application/atom+xml\r\n\r\n",
         print "<?xml version='1.0' encoding='utf-8'?>"
         print "<feed xmlns='http://www.w3.org/2005/Atom'>"
         print "  <title>" + self._e(self.branch._get_nick()) + "</title>"
         print "  <id>" + self._e(self.feedid) + "</id>"
         print "  <link href='" + self._e(self.baseuri) + "/'/>"
-        print "  <link rel='self' type='application/atom+xml' href='" + self._e(self.baseuri) + ".atom'/>"
+        print "  <link rel='self' type='application/atom+xml' href='" + self._e(self.baseuri) + "/" + os.path.basename(os.environ['REQUEST_URI']) + "'/>"
         print "  <updated>" + self._e(time.strftime("%Y-%m-%dT%H:%M:%SZ",time.gmtime(updated))) + "</updated>"
 
     def __del__(self):
@@ -56,6 +56,9 @@
         print "      </ul></dd>"
 
     def show(self, revno, rev, delta):
+        revno = str(revno)
+
+        print
         print "  <entry>"
         print "    <author>"
         print "      <name>" + self._e(rev.committer.split("<")[0].rstrip()) + "</name>"
@@ -80,12 +83,11 @@
     sys.exit()
 
 # Sanity check
-if not os.environ['REQUEST_METHOD'] in ['GET', 'HEAD']:
+if not os.environ.get('REQUEST_METHOD','GET') in ['GET', 'HEAD']:
     status(405, "Method Not Allowed")
 
 # Basic repository info
 try:
-    dir = os.environ["DOCUMENT_ROOT"] + "/" + cgi.FieldStorage().getvalue("dir")
     dir = cgi.FieldStorage().getvalue("dir")
     repo = BzrDir.open(dir).open_repository()
 except:
@@ -109,10 +111,14 @@
 # Location
 baseuri = "http://" + os.environ['HTTP_HOST']
 if os.environ['SERVER_PORT']!="80": baseuri += ":" + os.environ['SERVER_PORT']
-baseuri += re.sub(r'\.\w+$', '', os.environ['REQUEST_URI'])
+if os.path.basename(os.path.dirname(os.environ['REQUEST_URI'])) == dir:
+    baseuri += os.path.dirname(os.environ['REQUEST_URI'])
+else:
+    baseuri += re.sub(r'\.\w+$', '', os.environ['REQUEST_URI'])
 
-print "Last-Modified: " + time.ctime(last_rev.timestamp) + " GMT"
-print 'ETag: "%s"' % str(hash(branch._get_nick() + str(last_rev.timestamp)))
+if os.environ.get('SCRIPT_NAME',None):
+    print "Last-Modified: " + time.ctime(last_rev.timestamp) + " GMT"
+    print 'ETag: "%s"' % str(hash(branch._get_nick() + str(last_rev.timestamp)))
 
 lf = AtomFeed(baseuri, branch, first_rev.timestamp, last_rev.timestamp)
 show_log(branch,lf,None,True,'reverse',start_rev,branch.revno())

