[albatross-users] New version of the standalone http server
Dave Cole
djc at object-craft.com.au
Thu Jul 3 23:16:57 EST 2003
> Attached is an updated version of the standalone server with the
> following changes:
>
> * Fixed to support forms containing input fields with a "list"
> attribute. It only ever returned the first value in the get or
> post data before.
> * Added the current working directory to the path so that the
> httpd.py script can live anywhere.
> * changed the filename to al-httpd. An even better name might be
> al-simple-server.
It works beautifully. I would love to add this to Albatross to sit
next to your FastCGI code.
I made one small change to your code to make it a bit more flexible (I
hope). I let the application mainline construct the application
object.
--- al-httpd-orig 2003-07-03 23:09:30.000000000 +1000
+++ al-httpd 2003-07-03 23:07:18.000000000 +1000
@@ -149,7 +149,7 @@
# Load the application's module and create an application instance
module = __import__(appClass[:appClass.rindex('.')])
- app = getattr(module,appClass[appClass.rindex('.')+1:])()
+ app = getattr(module,appClass[appClass.rindex('.')+1:])
# Create the HTTP server
httpd = HTTPServer(app, port)
Now with the most trivial change to the form4 Albatross sample it
works fantastically.
--- samples/form4/form.py 2002-08-17 23:14:36.000000000 +1000
+++ form.py 2003-07-03 23:13:40.000000000 +1000
@@ -19,4 +19,5 @@
secret = '-=-secret-=-')
app.register_page('form', Form())
-app.run(Request())
+if __name__ == '__main__':
+ app.run(Request())
Now due to you code I can do this:
$ al-httpd form.app 8080
That is cool!
- Dave
--
http://www.object-craft.com.au
More information about the Albatross-users
mailing list