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
these were other data-specific edge cases that failed on my local