Turn off crash report if raven not available

Fix #121
This commit is contained in:
Julien Duponchelle 2015-03-31 21:52:00 +02:00
parent 36f5fd2865
commit 6d6cfacdc8

View File

@ -15,12 +15,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import raven
import os
import sys
import struct
import platform
try:
import raven
RAVEN_AVAILABLE = True
except ImportError:
# raven is not installed with deb package in order to simplify packagin
RAVEN_AVAILABLE = False
from .version import __version__
from .config import Config
@ -47,6 +53,8 @@ class CrashReport:
self._client = None
def capture_exception(self, request=None):
if not RAVEN_AVAILABLE:
return
server_config = Config.instance().get_section_config("Server")
if server_config.getboolean("report_errors"):
if self._client is None: