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
this is the main change.