pycs-devel archive weblog

A blog for archiving the pycs-devel mailing list

2003-3-29

Phillip Pearson: [PyCS-devel] PyCS / ht://Dig stuff now in PyCS CVS

I just committed some search stuff into CVS. This isn't everything just
yet - there's a decent-sized patch to ht://Dig itself to get it to build as
a Python module, and a small patch to Medusa:

The big deal here is that I'm using fork() to run the search code in a
separate process (because it's used to running as a CGI, and doesn't appear
to clean up after itself very well), which requires a couple of changes to
let the child processes exit properly. Also the authorizer and rewriting
code needed a bit of refactoring to work properly here.

Can't talk much now (in a hurry) but I wanted to post this so this is all
documented at least a little bit. Will blog more later and post the
ht://Dig patch.

Here are my CVS comments:

===
Added ht://Dig integration.

Makefile: added modules/system/search.py to the install list

authorizer.py: made it possible to call various functions without spitting
out a whole lot of junk to stdout

pycs.conf: added a new 'enablehtdig' variable that must be set before
search.py will do anything that would be dangerous without a patched copy of
medusa (i.e. fork)

pycs.py, pycs_settings.py, pycs_auth_handler.py: now we store a copy of the
authorizer so search.py can grab it later on (better than having to read it
each time)

pycs_module_handler.py: now we pass on SystemExit exceptions instead of
catching them, so an exiting child process actually exits (NB: we need
co-operation from medusa here - this is where the aforementioned patch to
medusa/http_server.py comes in)

pycs_rewrite_handler.py: moved the core url rewriting stuff into a new
method, so search.py can rewrite things as necessary when doing the security
checks

www/index.html: added 'search' link
===

And here's the medusa patch:

===
RCS file: /cvsroot/oedipus/medusa/http_server.py,v
retrieving revision 1.10
diff -u -r1.10 http_server.py
--- http_server.py 18 Dec 2002 14:55:44 -0000 1.10
+++ http_server.py 29 Mar 2003 10:47:59 -0000
@@ -495,6 +495,8 @@
# This isn't used anywhere.
# r.handler = h # CYCLE
h.handle_request (r)
+ except SystemExit:
+ raise
except:
self.server.exceptions.increment()
(file, fun, line), t, v, tbinfo =
asyncore.compact_traceback()
===

Cheers,
Phil :)