[medusa] freezing Medusa

Eugene Leitl eugene.leitl@l...
Tue, 27 Mar 2001 16:46:51 +0200 (MET DST)

It does run now. One-banana fix: I commented out the offending section

Another question: if I'm doing object publishing, what is 
the best way to parse arguments and GET/POST requests, preferably a la
Zope/Bobo, *without* requiring Zope/Bobo?

I've tried Guido's example for SimpleHTTPServer.py

import StringIO
import SimpleHTTPServer

BaseClass = SimpleHTTPServer.SimpleHTTPRequestHandler

CounterTemplate = """ <H1>Server

This <A HREF=./>server</A> has been accessed
<b>%d</b> times. """

count = 0

class MyRequestHandler(BaseClass):

def do_GET(self):
global count
count = count + 1

def send_head(self):
if self.path == "/counter.html":
return self.send_counter()
return BaseClass.send_head(self)

def send_counter(self):
self.send_header("Content-type", "text/html")
text = CounterTemplate % count
return StringIO.StringIO(text)

def test():


It does what I need, so in principle I don't need Medusa, but I don't have
any clue how to pass arguments to the methods and parse GET/PUT requests
the way CGI module does (packing them into dictionary). 

Confused in Krautland,

On Tue, 27 Mar 2001 Eugene.Leitl@l... wrote:
> Anything running wrong when freezing Medusa?
> Huh? The culprit seems to be becoming nobody:
> # become 'nobody'
> if os.name == 'posix':
> import os
> if hasattr (os, 'seteuid'):
> # look in ~medusa/patches for {set,get}euid.
> import pwd
> [uid, gid] = pwd.getpwnam ('nobody')[2:4]
> os.seteuid (uid)
> os.setegid (gid) 
> Can anybody clue me in?