Colin Fox
cfox at cfconsulting.ca
Sun Mar 7 11:19:02 EST 2004
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Gregory (Grisha) Trubetskoy wrote: | Why don't you use the publisher handler for that? | | Grisha | | On Sat, 6 Mar 2004, Colin Fox wrote: Hmm. Ok, what I'm trying to accomplish is this: I am building a site which is a combination of XML files (which get processed into HTML) and python files. I want the xml files to be processed by the xml_handler, regardless of where they are. I want the python files to be executed as python files regardless of where they are. Here's my .htaccess file: DirectoryIndex index.xml index.html index.py AddHandler python-program .xml .py PythonHandler xml_handler PythonDebug on PythonAutoReload on (By the way - it seems that PythonAutoReload (according to mod_python source) should cause mod_python to automatically re-load a module if it has changed. Is that true? If so, does that solve the issue of reloads that people have solved by setting MaxRequestsPerChild to 1?) I originally tried to solve this by putting two PythonHandler declarations in, but that didn't work. AddHandler python-program .xml PythonHandler xml_handler PythonDebug on AddHandler python-program .py PythonHandler mod_python.publisher PythonAutoReload on So now in my xml_handler file I have a chunk of code that looks like this: def handler(req): ~ if args['requestedfile'].endswith('.py'): ~ return process_py(req) ~ elif args['requestedfile'].endswith('.xml'): ~ return process_xml(req) ~ else: ~ return apache.ERROR This gets me almost where I want to be - I can process the two different types of files. Now I'm left with the fact that I want to be able to process XML files from a single function, but python files to be processed as python files, and from where they reside. Any suggestions? Thanks, ~ cf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAS3WmoaQ1/feGlJoRAgYuAJ9PF2bAjVrWY738acWysCkT7cjoYwCghFa+ O6l64siCyIIW5eH61PpMl7I= =w4r0 -----END PGP SIGNATURE-----
|