[Web-SIG] Exciting new developments :)

Peter Hunt floydophone at gmail.com
Mon Oct 18 03:46:01 CEST 2004

- My Twisted WSGI implementation is now fully-functional and tested
synchronously. The async API is broken. It's also now built upon
Philip's wsgiref library.

- I've written a WSGI object publisher, similar to Zope's ZPublisher.
It's extremely simple, but rather nice I'd say:

def publisher_application(root):
    I'm a ZPublisher-like application, except I run everything as a
WSGI application or coerce it to a string.
    If you don't want something published, start it with an underscore.
    Possible TODOs: security, list of what attributes are accessible
via the web.
                    insert base href optionally
                    should str() objects Content-type be text/plain or
    def app(environ, start_response):
        o = root # start at the root
        for elem in environ.get("PATH_INFO","").split("/"): # iterate
through every item in the path coming after this script
            if len(elem) > 0 and elem[0] != "_": # if the element
isn't blank and doesn't begin with an underscore...
                    o = getattr(o, elem) # try to get the next part of the path
                except AttributeError: # if it's not found...
                    start_response("404 Not Found",
[("Content-type","text/plain")]) # return a 404
                    return ["Resource not found."] # and a nice little message
        if callable(o): # if the final object is callable...
            return o(environ, start_response) # call it as a WSGI application
            start_response("200 OK", [("Content-type","text/html")]) #
otherwise, assume it's just a string.
            return [str(o)]
    return app

- If you've heard of FlowScript, I've implemented something very
similar for WSGI on Stackless. It lets you write applications without
worrying about writing FSM's. Once I get a good example, I'll post it.

- I fixed up Ian Bicking's session middleware a bit to be more
browser, OS, and machine friendly. I also removed all of its external
dependencies and integrated it with my cookie middleware

- My cookie middleware is now stable

- I've started putting together a WSGI unit tests library...would
anyone like to contribute?

Since I have no hosting as of right now, I can't post any of this cool
stuff. However, once it's back up, I'll send a message to the list.

More information about the Web-SIG mailing list