getsentry/raven-python — pull request #255 by rcoup (2013-02-08 00:07:23+00:00)
Title: Django: improvements around Site tag

Currently `DjangoClient.build_msg()` looks up the django.contrib.sites model to find the associated domain to use in the site tag, even if the `SENTRY_SITE` setting will override any result. In addition, any errors looking up the site (eg. DB problems) will crash out the reporting.

The attached code:
* skips doing the DB lookup if `DjangoClient.site` (aka the `SENTRY_SITE` setting) is used
* catches any errors and uses `SITE_ID` as a fallback instead of the domain