notify user of any errors in saving.
refactoring code to be a bit DRYer, fixing bug in topictree rendering.
refactoring JS code to use better names, common function to show API messages.  Removed outdated logic for view-based notifications, which broke once caching was implemented.
made messages more shared and compact, and made sure related error messages displayed to the same client-side message ID--to avoid multiple messages on the same page, with similar messages.
fix type-o in exercises; make show_api_messages more robust (so that when it blows up, it does so in a more reasonable way.
remove pdb, and debug should be DEBUG
added get_or_initialize class function, cleaned up js formatting, added test for mastery.
Merge branch 'develop' of github.com:learningequality/ka-lite into notify_user

Conflicts:
	kalite/main/tests/browser_tests.py
Merge pull request #329 from bcipolli/notify_user

Improved error detection and handling through [Exercise/Video]Log API calls