dots tweaks and fixes

downgrades some errors to failing more gracefully and a bit of
pep-8 stuff. sorry about mixing the two.

primary stack trace fix is: http://manage.dimagi.com/default.asp?123395
Merge pull request #4007 from dimagi/pact-again

dots tweaks and fixes