[Zope-dev] enhanced pcgi_publisher.py

Jeff Bauer jeffbauer@bigfoot.com
Sat, 22 May 1999 19:13:51 -0500


Hi everyone.

With the availability of Zope2 alpha I'd like to take
an opportunity to dust off a version of pcgi_publisher
I worked on last December.  I withdrew it after the
initial Zope release because too many things were
changing too quickly.

Since then, Digital Creations has released PCGIServer,
which works between pcgi-wrapper and Medusa.  This is
especially handy for connecting to Zope through your
web server.

However, I have other reasons for wanting to maintain
(and even extend) pcgi_publisher.  The reasons are
related to legacy projects and other projects in 
which I prefer to allocate one long running process 
(LRP) per session.

After reviewing my earlier notes, here is list of
proposed enhancements:

1. Added support for concurrency (PCGI_THREAD_POOL
   directive) by using standard Python module
   SocketServer.  Guido accepted a slight patch 
   to the SocketServer module that I submitted prior 
   to the Python 1.5.2 final.

2. Added ability to launch processes manually by
   passing it the pathname of the pcgi info file.

3. Applied fixes suggested by Digital Creations.

4. Inactivity timer: shuts down the process after
   a designated value is exceeded.

Item 2 becomes less important as we move process
launch control outside of PCGI, but it's still
useful for testing, perhaps.

Item 4 is handy for some of my projects, where
I might allocate one process per session.  Other
Zopists may find it useful.

If there are no objections, I'll try to have a new
version ready soon.  It could possibly be added to
the Zope contribution area or bundled with the next
alpha/beta release.  Everything should be backwards 
compatible with prior versions of pcgi_publisher, 
with the possible/conditional exception of items 
discussed below:

1. Starting around line 164 we have a try/except
   block to catch import errors:

        try:
            from ZPublisher import publish_module
        except ImportError:
            try:
                from cgi_module_publisher import publish_module
            except ImportError:
                return self.fatalError(
                    "unable to import publish_module from ZPublisher")

   Is there any reason to continue to check for cgi_module_publisher?

2. initPrincipia() -- is this still used by anyone?

3. PCGI_WORKING_DIR has been deprecated for over a year now.  Is
   anyone using it?

Finally, I'm aware there are other features/fixes/requests that
ought to be addressed with pcgi:

  - out-of-band communications
  - process launch
  - data streaming
  - mod_pcgi

The enchanced pcgi_publisher will do nothing to address these
issues <0.7 wink> but they haven't been forgotten.

Best regards,

Jeff Bauer
Rubicon, Inc.