dimagi/email-reports — pull request #2 by mlavin (2012-12-03 21:10:28+00:00)
Title: Restore HTML Report Functionality

The `ReportSubscription.send_html_to_user` was not used and not longer functioning on master. It was also fairly inflexible because it used a static `SCHEDULABLE_REPORTS` configuration which wasn't actually configurable.

This change adds a report type flag to `SchedulableReport` to allow for both PDF and HTML reports. It changes the parser to use [html5lib][0] to parse the response body to find the desired title and content elements. There are now tests for the HTML email sending as well as the HTML parser.

A couple small notes. I was hoping that this change would remove the dependency on `rapidsms-logistics` but the view templates still extend from `logistics/reports_base.html` and changing them would be difficult to keep backwards compatible and out of scope for this change. There is also a small problem running the test suite due to a strange/stray `import log` in [`rapidsms-logistics`][1]. I'll open a pull request to have this removed. In the meantime you can get around this import by problem by adding an empty `log.py` in the repo root.

Let me know if there are any questions/comments/problems with this change (cc @rowenaluk).

[0]: http://code.google.com/p/html5lib/
[1]: https://github.com/dimagi/rapidsms-logistics/blob/master/logistics/management/commands/__init__.py#L1