[Moin-user] run MoinMoin with Python server?

Kevin Altis altis at semi-retired.com
Mon Aug 5 10:40:02 EDT 2002


Steve Holden and I found a fix for the POST handling on Windows this
weekend. Guido has assigned the tracker item to Steve, so hopefully
something will get checked in soon.

http://sourceforge.net/tracker/?func=detail&aid=427345&group_id=5470&atid=10
5470

The fix turned out to be pretty simple.

            if self.command.lower() == "post" and nbytes > 0:
                data = self.rfile.read(nbytes)
                fi.write(data)
                # now throw away data past Content-length
                while select.select([self.rfile._sock], [], [], 0)[0] != []:
                    waste = self.rfile._sock.recv(1)
            fi.close()

Only the two lines below the comment are required along with an "import
select" at the top of CGIHTTPServer.py. This is slightly verbose, so Steve
may do something a bit tighter; the code block below is around line 247,
just look for the:
  if self.command.lower() == "post" and nbytes > 0:

Please refer to the bug tracker item for more info. Anyway, MoinMoin runs
like a champ as a simple CGI with the built-in Python web server and CGI
handler.

Note that this fix was for servers running on Windows, it is still unclear
whether Python code on Unix suffers from this same POST bug of not reading
the extra CR/LF sent by IE.

ka

> -----Original Message-----
> From: moin-user-admin at lists.sourceforge.net
> [mailto:moin-user-admin at lists.sourceforge.net]On Behalf Of Kevin Altis
> Sent: Wednesday, July 31, 2002 11:33 PM
> To: Moin-User
> Subject: RE: [Moin-user] run MoinMoin with Python server?
>
>
> I should have done a little more investigation before my original
> post. The
> CGI POST problem does appear to be the same bug as already noted at:
>
> http://sourceforge.net/tracker/?func=detail&aid=427345&group_id=54
> 70&atid=10
> 5470
>
> and
>
> http://sourceforge.net/tracker/?func=detail&aid=430160&group_id=54
> 70&atid=10
> 5470
>
> The bug is specific to POST handling with IE on Windows, tested
> with IE 5.5
> and IE 6. It is not a problem with say Netscape on Windows or
> even IE on the
> Mac.
>
> I would still like to hear about any other information related to running
> MoinMoin with a simple Python web server instead of say Apache or IIS in
> case there are other issues I should be aware of. I'm going to take this
> opportunity to chase the socket issue to see if a workaround can
> be added to
> the Python standard libs once and for all.
>
> Thanks,
>
> ka
> ---
> Kevin Altis
> altis at semi-retired.com
>
> > -----Original Message-----
> > From: moin-user-admin at lists.sourceforge.net
> > [mailto:moin-user-admin at lists.sourceforge.net]On Behalf Of Kevin Altis
> > Sent: Wednesday, July 31, 2002 6:21 PM
> > To: Moin-User
> > Subject: [Moin-user] run MoinMoin with Python server?
> >
> >
> > I'm trying to get MoinMoin working with a minimal Python server
> > based on the
> > HTTPServer and CGIHTTPRequestHandler in the Python Standard
> > Libraries. I was
> > able to get MoinMoin running with a minimal variation of the install
> > instructions and I can post those instructions here if there is
> > interest. I
> > ended up putting moin.cgi and moin_config.py in a /cgi-bin
> directory, the
> > data is in a c:\moin\data directory and the images and css are
> in a /wiki
> > directory at the html (htdocs) root of the server.
> >
> > The problem I've run into is that even though I can do GETs and
> POSTs with
> > MoinMoin, some kind of failure occurs after the POST, so that while data
> > from an edit appears to be accepted, there is a redirect or
> something that
> > is failing as part of the request. I've attached a copy/paste from the
> > console (sorry about the wrapping) showing the error output on my
> > box when I
> > click the "Save Changes" button during an edit
> >
> > http://localhost/cgi-bin/moin.cgi/FrontPage?action=edit
> >
> > This could be related to some other bugs that have been reported
> > with Python
> > socket handling and Internet Explorer 5.x, but I don't know
> MoinMoin well
> > enough at this point to know what to look for. What I have now is
> > essentially a read-only MoinMoin, which isn't particularly
> useful, so I'm
> > looking for a fix.
> >
> > I'm wondering whether anyone has gotten MoinMoin working correctly on a
> > Windows system using just the Python standard libs for the web
> server? If
> > so, how about on Windows, specifically Windows 2000? I really
> > don't want to
> > have to install IIS or Apache just to use MoinMoin locally,
> > Python should be
> > able to handle this out of the box. A basic web server in Python is very
> > simple as the script referenced below shows.
> >
> > The PythonCard webserver sample comes with a console_server.py
> script that
> > essentially works the same as the GUI front-end web server. The latest
> > version of the script is in cvs at the URL below. The script is
> different
> > from the one in release 0.6.8 because I added '.cgi' extension
> support to
> > the request handler to avoid having to change moin.cgi references in
> > MoinMoin. I'm using Windows 2000 and Python 2.2.1, but the script should
> > work without change on other systems.
> >
> > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pythoncard/PythonCa
> rdPrototyp
> e/samples/webserver/
>
> Any feedback or ideas would be appreciated. I would love to get MoinMoin
> working as a CGI with a simple Python server!
>
> ka
> ---
> Kevin Altis
> altis at semi-retired.com





More information about the Moin-user mailing list