[Twisted-Python] mktap web --index patch

Mike Snitzer mike.twisted at snitzer.net
Sun Oct 27 11:49:55 MST 2002


All,

It would appear that a twisted web server can't be easily configured
(via mktap web --index) to use both index.html _and_ index.php (or any
other combination) as directory indexes.

mktap2.1 web --help
...
  -i, --index=            Add the name of a file used to check for directory
                          indexes. [default: index, index.html]

SO.. I tried:
1) mktap2.1 web --path ~/public_html/ --index index.php 
and my php indexed directories work; but index.html indexed dirs do not

2) mktap2.1 web --path ~/public_html/ --index index.html,index.php
and get the mktap web usage

I've got to believe what I'm looking to do is something others would want
to be able to configure too.  However, the relevant twisted/tap/web.py
code will only allow the user to add a single directory index; pretty
strange limitation... 

Here's a patch to enable a user to specify multiple directory indexes to
the web server via mktap (i.e. like #2 above):

--- Twisted.orig/twisted/tap/web.py     Wed Oct 23 07:56:52 2002
+++ Twisted/twisted/tap/web.py  Sun Oct 27 13:35:34 2002
@@ -54,10 +54,11 @@
         self.opts['root'] = None
 
     def opt_index(self, indexName):
-        """Add the name of a file used to check for directory indexes.
+        """Add the name of a file(s) used to check for directory indexes.
         [default: index, index.html]
         """
-        self.opts['indexes'].append(indexName)
+        for index in string.split(indexName,','):
+            self.opts['indexes'].append(index)
 
     opt_i = opt_index








More information about the Twisted-Python mailing list