Bug 856919 - Fix request.locale attribute error

Getting an AttributeError from request.locale on the 500
error handler path. Check for .locale before referencing it.