Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure plugins can determine if they are allowed to be toggled for pr…

…ojects
  • Loading branch information...
commit ba49d4c09b23a034ef90756948e096ccc932db36 1 parent 360f96b
@dcramer dcramer authored
View
8 sentry/plugins/base.py
@@ -154,6 +154,8 @@ def is_enabled(self, project=None):
"""
if not self.enabled:
return False
+ if not self.can_enable_for_projects():
+ return True
if project:
project_enabled = self.get_option('enabled', project)
if project_enabled is False:
@@ -222,6 +224,12 @@ def has_site_conf(self):
def has_project_conf(self):
return self.project_conf_form is not None
+ def can_enable_for_projects(self):
+ """
+ Returns a boolean describing whether this plugin can be enabled on a per project basis
+ """
+ return True
+
def get_form_initial(self, project=None):
return {}
View
6 sentry/templates/sentry/projects/plugins/list.html
@@ -42,7 +42,11 @@
{% if plugin.version %}{{ plugin.version }}{% else %}<em>{% trans "n/a" %}</em>{% endif %}
</td>
<td style="text-align:center;">
- <input type="checkbox" name="plugin" value="{{ plugin.slug }}"{% if is_enabled %} checked="checked"{% endif %}/>
+ {% if plugin.can_enable_for_projects %}
+ <input type="checkbox" name="plugin" value="{{ plugin.slug }}"{% if is_enabled %} checked="checked"{% endif %}/>
+ {% else %}
+ <em>{% trans "n/a" %}</em>
+ {% endif %}
</td>
</tr>
{% endfor %}
View
3  sentry/web/frontend/projects.py
@@ -403,7 +403,8 @@ def manage_plugins(request, project):
if request.POST:
enabled = set(request.POST.getlist('plugin'))
for plugin in plugins.all():
- plugin.set_option('enabled', plugin.slug in enabled, project)
+ if plugin.can_enable_for_projects():
+ plugin.set_option('enabled', plugin.slug in enabled, project)
return HttpResponseRedirect(request.path + '?success=1')
context = csrf(request)
View
2  setup.py
@@ -50,7 +50,7 @@
setup(
name='sentry',
- version='3.8.0',
+ version='3.8.1',
author='David Cramer',
author_email='dcramer@gmail.com',
url='http://github.com/dcramer/sentry',
Please sign in to comment.
Something went wrong with that request. Please try again.