TT#43813 hotfix: split settings per application

Using https://django-appconf.readthedocs.io/en/latest/ helps us to
keep configs per application

Change-Id: Id41f0f6ce6b008428a1136f85ecf3b9d86f3189f
changes/18/38718/3
Victor Seva 6 years ago
parent 3237f930fd
commit 7647cfcc48

@ -0,0 +1,24 @@
# Copyright (C) 2020 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings # noqa
from appconf import AppConf
class HotfixConf(AppConf):
WF_REGEX = r"TT#(\d+)"
ARTIFACT = "debian_changelog.txt"
class Meta:
prefix = "hotfix"

@ -1,24 +1,24 @@
# Copyright (C) 2015 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# 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 logging
import re
from django.db import models
logger = logging.getLogger(__name__)
workfront_re = re.compile(r"TT#(\d+)")
from .conf import settings
workfront_re = re.compile(settings.HOTFIX_WF_REGEX)
class WorkfrontNoteInfo(models.Model):
@ -27,11 +27,7 @@ class WorkfrontNoteInfo(models.Model):
version = models.CharField(max_length=50, null=False)
class Meta:
unique_together = [
"workfront_id",
"projectname",
"version"
]
unique_together = ["workfront_id", "projectname", "version"]
@staticmethod
def getIds(change):

@ -0,0 +1,27 @@
# Copyright (C) 2015 The Sipwise Team - http://sipwise.com
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from django.test import TestCase
class TestHotfixConf(TestCase):
def test_django_settings(self):
from django.conf import settings
self.assertEqual(settings.HOTFIX_ARTIFACT, "debian_changelog.txt")
def test_hotfix_settings(self):
from hotfix.conf import settings
self.assertEqual(settings.HOTFIX_ARTIFACT, "debian_changelog.txt")

@ -135,5 +135,3 @@ CELERY_TASK_SERIALIZER = "json"
CELERY_RESULT_SERIALIZER = "json"
CELERY_ACCEPT_CONTENT = ["json"]
CELERY_RESULT_BACKEND = "django-db"
HOTFIX_ARTIFACT = "debian_changelog.txt"

Loading…
Cancel
Save