annotate rhodecode/lib/middleware/sentry.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents 9937afa7f093
children 7e5f8c12a3fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2939
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 # This program is free software: you can redistribute it and/or modify
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 # it under the terms of the GNU General Public License as published by
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 # the Free Software Foundation, either version 3 of the License, or
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 # (at your option) any later version.
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 #
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 # This program is distributed in the hope that it will be useful,
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 # GNU General Public License for more details.
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 #
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 # You should have received a copy of the GNU General Public License
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
14 """
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
15 rhodecode.lib.middleware.sentry
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
17
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
18 middleware to handle sentry/raven publishing of errors
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
19
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
20 :created_on: September 18, 2012
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
21 :author: marcink
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
22 :copyright: (c) 2013 RhodeCode GmbH.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
23 :license: GPLv3, see LICENSE for more details.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
24 """
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 2973
diff changeset
25
2939
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 try:
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28 from raven.base import Client
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 from raven.contrib.pylons import list_from_setting
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 from raven.middleware import Sentry as Middleware
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 except ImportError:
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 Sentry = None
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 else:
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 class Sentry(Middleware):
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 def __init__(self, app, config, client_cls=Client):
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 client = client_cls(
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 dsn=config.get('sentry.dsn'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 servers=list_from_setting(config, 'sentry.servers'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39 name=config.get('sentry.name'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40 key=config.get('sentry.key'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 public_key=config.get('sentry.public_key'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 secret_key=config.get('sentry.secret_key'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 project=config.get('sentry.project'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44 site=config.get('sentry.site'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45 include_paths=list_from_setting(config, 'sentry.include_paths'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 exclude_paths=list_from_setting(config, 'sentry.exclude_paths'),
dbe3cfb81446 Added Errormator and Sentry support part of pull request #71
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 )
2973
9937afa7f093 whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2939
diff changeset
48 super(Sentry, self).__init__(app, client)