Re: pyblosxom 3000
Steven Armstrong <[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
will guaraldi wrote: > > Steven, pretend I haven't looked at what you've done at all. (My > apologies.) > > Is there any way for PyBlosxom to know whether it's being run in a CGI, > WSGI, Twisted, or some other context? Are there flags or something > along those lines available in os.environ or some place like that? > > Or are we going to have to build different pyblosxom.cgi kinds of > scripts that handle building the request appropriate to the run context? > > I'm a big fan of fixing PyBlosxom so the cgi script handles more of the > setup. Then using that structure to allow PyBlosxom to work in Twisted, > WSGI and the various other frameworks. I'm also a fan of building a > Response object. I think someone mentioned something along those lines > already on the list. If someone could point me to a diff against the > current CVS code, I'd like to take a look at it. > > /will > I don't think there's one specific flag or variable that tells you that. There are a few hints though. For example: Twisted sets SERVER_SOFTWARE to "TwistedWeb". A WSGI server will put 'wsgi.input', 'wsgi.ouput' and 'wsgi.error' in its environment. As of my understanding the easiest way is to put all shared code into a module. Then have a "startup-script" for each environment. Similar to how it's done in Moinmoin. Any direct access to os.environ, sys.stdin, sys.stdout, sys.stderr and the like should be avoided from within modules/plugins. cheers Steven ps: I'll post you a diff regarding the Response stuff. ------------------------------------------------------- The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt