Pylons and Apache with repoze.who BasicAuth

To be able to use Basic Authentification in repoze.who running in a wsgi
app in your Apache installation, you need to tell Apache to
WSGIPassAuthorization. An Apache configuration like this will do:

# Setup mod_wsgi
WSGIPythonHome /var/www/pylons/runtime
WSGIScriptAlias /myApp /var/www/pylons/myApp/mod_wsgi/dispatch.wsgi
WSGIPassAuthorization On

<directory /var/www/pylons/myApp/mod_wsgi>
Order deny,allow
Allow from all

The importanat part here is

WSGIPassAuthorization On

This will pass HTTP authorisation headers through to the WSGI

Sources: Repoze-dev Mailing List, modwsgi Wiki

Generating Faults in Pylons XMLRPCController

This might seem easy enough, but it took me a while to get it right
since the Pylons documentation is a bit misleading here, really. It says
you should use xmlrpc_fault from pylons.controllers.xmlrpc but
that’s actually not working if you’re doing something like:

from pylons.controllers.xmlrpc import xmlrpc_fault
return xmlrpc_fault( 101, "My Error" )

This will wrap an xmlrpclib.Fault into a
pylons.controllers.util.Reponse object which will fail to marshal
with something like:

TypeError: cannot marshal  objects

The correct way to do it is:

import xmlrpclib...return xmlrpclib.Fault( 101, "My Error" )

Connecting Apache2 and Tomcat6

If you ever need to serve Tomcat applications through Apache2, here is a
quick guide on how to do this on Ubuntu.

First, install mod-jk:

sudo apt-get install libapache2-mod-jk
sudo a2enmod jk

Then, edit

sudo vi /etc/libapache2-mod-jk/

and adapt the following values (assuming you have installed the

workers.java_home = /usr/lib/jvm/java-6-openjdk

Then, mount the site using JkMount. Do

sudo vi /etc/apache2/sites-enabled/000-default

and then add the following line

JkMount /path/to/app/* ajp13_worker

And update the mod-jk settings in jk.load. do

sudo vi /etc/apache2/mods-available/jk.load

and update to file to read like this

LoadModule jk_module /usr/lib/apache2/modules/
JkWorkersFile /etc/libapache2-mod-jk/
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel error

Update the server.xml with

sudo vi /etc/tomcat6/server.xml

and then uncommenting the line

<connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Finally, restart the services

sudo /etc/init.d/apache2 restart
sudo /etc/init.d/tomcat6 restart