2016-12-10 14:55:36 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Settings views
|
|
|
|
"""
|
|
|
|
|
|
|
|
from __future__ import unicode_literals, absolute_import
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from tailbone.views import settings as base
|
|
|
|
|
|
|
|
|
|
|
|
class SettingsView(base.SettingsView):
|
|
|
|
"""
|
|
|
|
Prevent edit/delete for 'feedback' email settings
|
|
|
|
"""
|
2018-08-17 13:08:48 -05:00
|
|
|
protected = [
|
|
|
|
re.compile(r'^rattail\.mail\.user_feedback\..*'),
|
|
|
|
re.compile(r'^rattail\.mail\.upgrade_success\..*'),
|
|
|
|
re.compile(r'^rattail\.mail\.upgrade_failure\..*'),
|
|
|
|
]
|
2016-12-10 14:55:36 -06:00
|
|
|
|
|
|
|
def editable_instance(self, setting):
|
2018-08-17 13:08:48 -05:00
|
|
|
for pattern in self.protected:
|
|
|
|
if pattern.match(setting.name):
|
|
|
|
return False
|
|
|
|
return True
|
2016-12-10 14:55:36 -06:00
|
|
|
|
|
|
|
def deletable_instance(self, setting):
|
2018-08-17 13:08:48 -05:00
|
|
|
for pattern in self.protected:
|
|
|
|
if pattern.match(setting.name):
|
|
|
|
return False
|
|
|
|
return True
|
2016-12-10 14:55:36 -06:00
|
|
|
|
|
|
|
|
|
|
|
def includeme(config):
|
|
|
|
SettingsView.defaults(config)
|