[Twisted-commits] change --static to --path.

carmstro CVS twisted-python@twistedmatrix.com
Wed, 17 Apr 2002 11:58:05 -0500


Modified files:
Twisted/ChangeLog 1.54 1.55
Twisted/README 1.75 1.76
Twisted/admin/accepttests 1.4 1.5
Twisted/doc/howto/doc-standard.html 1.4 1.5
Twisted/doc/man/mktap.1 1.9 1.10
Twisted/twisted/tap/web.py 1.20 1.21

Log message:
change --static to --path.


ViewCVS links:
Error generating URL for file '{'filename': 'ChangeLog', 'r2': (1, 55), 'r1': (1, 54), 'pathname': 'Twisted'}'
Error generating URL for file '{'filename': 'README', 'r2': (1, 76), 'r1': (1, 75), 'pathname': 'Twisted'}'
http://twistedmatrix.com/users/jh.twistd/viewcvs/cgi/viewcvs.cgi/admin/accepttests.diff?r1=text&tr1=1.4&r2=text&tr2=1.5&cvsroot=Twisted
http://twistedmatrix.com/users/jh.twistd/viewcvs/cgi/viewcvs.cgi/doc/howto/doc-standard.html.diff?r1=text&tr1=1.4&r2=text&tr2=1.5&cvsroot=Twisted
http://twistedmatrix.com/users/jh.twistd/viewcvs/cgi/viewcvs.cgi/doc/man/mktap.1.diff?r1=text&tr1=1.9&r2=text&tr2=1.10&cvsroot=Twisted
http://twistedmatrix.com/users/jh.twistd/viewcvs/cgi/viewcvs.cgi/twisted/tap/web.py.diff?r1=text&tr1=1.20&r2=text&tr2=1.21&cvsroot=Twisted

Index: Twisted/README
diff -u Twisted/README:1.75 Twisted/README:1.76
--- Twisted/README:1.75	Thu Apr 11 07:02:43 2002
+++ Twisted/README	Wed Apr 17 09:58:00 2002
@@ -95,12 +95,13 @@
   The normal type of server to create is a webserver.  You can run this
   command::
 
-    % mktap web --static static
+    % mktap web --path static
 
-  which will make a "static" webserver (one that reads from the filesystem) and
-  serve pages from the provided 'static' directory.  This creates a file named
-  'web.tap'.  By default, this server will run on port 8080, but you can change
-  it with the --port option.
+  which will make a path-based webserver (one that reads from the filesystem)
+  and serve pages from the provided 'static' directory.  This will
+  automatically execute CGIs, epys, rpys, and php files.  This creates a file
+  named 'web.tap'.  By default, this server will run on port 8080, but you can
+  change it with the --port option.
 
   You can also create a telnet server::
 

Index: Twisted/doc/man/mktap.1
diff -u Twisted/doc/man/mktap.1:1.9 Twisted/doc/man/mktap.1:1.10
--- Twisted/doc/man/mktap.1:1.9	Tue Apr  9 18:03:19 2002
+++ Twisted/doc/man/mktap.1	Wed Apr 17 09:58:02 2002
@@ -48,21 +48,30 @@
 .TP
 \fB\-u\fR, \fB\--user\fR
 Makes a server with ~/public_html and
-~/.twistd-web-service support for users.
+~/.twistd-web-pb support for users.
 .TP
 \fB\--personal\fR
 Instead of generating a webserver, generate a
-ResourcePublisher which listens on ~/.twistd-web-service
+ResourcePublisher which listens on ~/.twistd-web-pb
 .TP
-\fB\-s\fR, \fB\--static\fR \fI<path>\fR
+\fB\-s\fR, \fB\--path\fR \fI<path>\fR
 <path> is either a specific file or a directory to be
 set as the root of the web server. Use this if you
-have a directory full of HTML, cgi, or php3 files or
+have a directory full of HTML, cgi, php3, epy, or rpy files or
 any other files that you want to be served up raw.
 .TP
 \fB\-p\fR, \fB\--port\fR \fI<port>\fR
 <port> is a number representing which port you want to
 start the server on.
+.TP
+\fB\-p\fR, \fB\--mime_type\fR \fI<mimetype>\fR
+<mimetype> is the default MIME type to use for
+files in a --path web server when none can be determined
+for a particular extension. The default is 'text/html'.
+.TP
+\fB\-p\fR, \fB\--allow_ignore_ext\fR
+Specify wether or not a request for 'foo' should return 'foo.ext'.
+Default is off.
 .TP
 \fB\-t\fR, \fB\--telnet\fR \fI<port>\fR
 Run a telnet server on <port>, for additional

Index: Twisted/admin/accepttests
diff -u Twisted/admin/accepttests:1.4 Twisted/admin/accepttests:1.5
--- Twisted/admin/accepttests:1.4	Wed Apr 10 14:30:45 2002
+++ Twisted/admin/accepttests	Wed Apr 17 09:58:01 2002
@@ -52,7 +52,7 @@
 
 def staticWebTest():
     message("Running Static Web Test")
-    cmd("mktap web --static %s/../static" % twistedBinDir)
+    cmd("mktap web --path %s/../static" % twistedBinDir)
     twistdf("web")
     message("You should see an 'it worked' page now.",
             "(depending on your browser, you may need to reload)")

Index: Twisted/twisted/tap/web.py
diff -u Twisted/twisted/tap/web.py:1.20 Twisted/twisted/tap/web.py:1.21
--- Twisted/twisted/tap/web.py:1.20	Wed Apr 17 01:00:41 2002
+++ Twisted/twisted/tap/web.py	Wed Apr 17 09:58:03 2002
@@ -64,10 +64,10 @@
 
     opt_u = opt_user
 
-    def opt_static(self, path):
+    def opt_path(self, path):
         """<path> is either a specific file or a directory to
         be set as the root of the web server. Use this if you
-        have a directory full of HTML, cgi, or php3 files or
+        have a directory full of HTML, cgi, php3, epy, or rpy files or
         any other files that you want to be served up raw.
         """
 
@@ -78,18 +78,27 @@
             '.epy': script.PythonScript
             }
 
+    def opt_static(self, path):
+        """Same as --path, this is deprecated and will be removed in a
+        future release."""
+        print ("WARNING: --static is deprecated and will be removed in"
+               "a future release. Please use --path.")
+        self.opt_path(path)
+    opt_s = opt_static
+
+    
     def opt_class(self, className):
         """Create a Resource subclass with a zero-argument constructor.
         """
         classObj = reflect.namedClass(className)
         self.opts['root'] = classObj()
 
-    opt_s = opt_static
+
 
     def opt_mime_type(self, defaultType):
         """Specify the default mime-type for static files."""
         if not isinstance(self.opts['root'], static.File):
-            print "You can only use --mime_type after --static."
+            print "You can only use --mime_type after --path."
             sys.exit(2)
         self.opts['root'].defaultType = defaultType
     opt_m = opt_mime_type
@@ -98,7 +107,7 @@
     def opt_allow_ignore_ext(self):
         """Specify wether or not a request for 'foo' should return 'foo.ext'"""
         if not isinstance(self.opts['root'], static.File):
-            print "You can only use --allow_ignore_ext after --static."
+            print "You can only use --allow_ignore_ext after --path."
             sys.exit(2)
         self.opts['root'].allowExt = 1
 

Index: Twisted/doc/howto/doc-standard.html
diff -u Twisted/doc/howto/doc-standard.html:1.4 Twisted/doc/howto/doc-standard.html:1.5
--- Twisted/doc/howto/doc-standard.html:1.4	Sun Mar 17 15:35:45 2002
+++ Twisted/doc/howto/doc-standard.html	Wed Apr 17 09:58:02 2002
@@ -81,14 +81,14 @@
 <h3>"shell"</h3>
 <pre>
     &lt;pre class="shell"&gt;
-    $ mktap web -s /var/www
+    $ mktap web --path /var/www
     &lt;/pre&gt;
 </pre>
 
 <hr />
 
 <pre class="shell">
-$ mktap web -s /var/www
+$ mktap web --path /var/www
 </pre>
 <hr />
 

Index: Twisted/ChangeLog
diff -u Twisted/ChangeLog:1.54 Twisted/ChangeLog:1.55
--- Twisted/ChangeLog:1.54	Wed Apr 17 01:37:50 2002
+++ Twisted/ChangeLog	Wed Apr 17 09:58:00 2002
@@ -5,6 +5,10 @@
 	disabled by default. If you want a --static webserver that
 	uses this feature, use 'mktap web --static <dir> --allow_ignore_ext'.
 
+	* twisted/tap/web.py: Also switched --static to --path; it doesn't
+	make sense to call something that automatically executes cgis, epys,
+	rpys, php, etc., "static". :-)
+
 2002-04-14  Itamar Shtull-Trauring  <itamarst@twistedmatrix.com>
 
 	* HTTP 1.1 now supports persistent and pipelined connections.