Fix bug 1018989: Alter base template to work without context processors.

Fixes some issues with the base template assuming certain variables 
exist. Includes a test to ensure it stays fixed.