summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJonah BrĂ¼chert <jbb@kaidan.im>2024-05-23 04:02:21 +0200
committerJonah BrĂ¼chert <jbb@kaidan.im>2024-05-23 04:31:59 +0200
commit5cd643861b48768a90788f9d6ad3bacf7566e586 (patch)
tree1195b2a0ea2ed08eabc7dfef0bbb9e5366c472e4 /src/lib
parent44af447d030e519c4ac22175507dac3e26ec4b05 (diff)
downloadbcfg2-5cd643861b48768a90788f9d6ad3bacf7566e586.tar.gz
bcfg2-5cd643861b48768a90788f9d6ad3bacf7566e586.tar.bz2
bcfg2-5cd643861b48768a90788f9d6ad3bacf7566e586.zip
Remove broken django version checks
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Bcfg2/Reporting/Storage/DjangoORM.py11
-rw-r--r--src/lib/Bcfg2/Reporting/models.py10
-rw-r--r--src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py6
-rw-r--r--src/lib/Bcfg2/Server/Admin.py9
-rw-r--r--src/lib/Bcfg2/Server/Core.py7
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Reporting.py6
6 files changed, 10 insertions, 39 deletions
diff --git a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
index 57accdb3b..49089ae12 100644
--- a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
+++ b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
@@ -43,13 +43,10 @@ def load_django_models():
def get_all_field_names(model):
- if django.VERSION[0] == 1 and django.VERSION[1] >= 8:
- return [field.name
- for field in model._meta.get_fields()
- if field.auto_created == False and
- not (field.is_relation and field.related_model is None)]
- else:
- return model._meta.get_all_field_names()
+ return [field.name
+ for field in model._meta.get_fields()
+ if field.auto_created == False and
+ not (field.is_relation and field.related_model is None)]
class DjangoORM(StorageBase):
diff --git a/src/lib/Bcfg2/Reporting/models.py b/src/lib/Bcfg2/Reporting/models.py
index 345dd1bc3..faa972204 100644
--- a/src/lib/Bcfg2/Reporting/models.py
+++ b/src/lib/Bcfg2/Reporting/models.py
@@ -62,15 +62,7 @@ def _quote(value):
"""
global _our_backend
if not _our_backend:
- if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
- _our_backend = connections[get_db_label('Reporting')].ops
- else:
- from django.db import backend
- try:
- _our_backend = backend.DatabaseOperations(
- connections[get_db_label('Reporting')])
- except TypeError:
- _our_backend = backend.DatabaseOperations()
+ _our_backend = connections[get_db_label('Reporting')].ops
return _our_backend.quote_name(value)
diff --git a/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py b/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py
index b42c10766..92cbe1196 100644
--- a/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py
+++ b/src/lib/Bcfg2/Reporting/templatetags/bcfg2_tags.py
@@ -395,11 +395,7 @@ class SortLinkNode(template.Node):
self.text = template.Variable(text)
def _render_template(self, context):
- if django.VERSION[0] == 1 and django.VERSION[1] >= 8:
- return context.template.engine.from_string(self.__TMPL__)
- else:
- from django.template.loader import get_template_from_string
- return get_template_from_string(self.__TMPL__).render(context)
+ return context.template.engine.from_string(self.__TMPL__)
def render(self, context):
try:
diff --git a/src/lib/Bcfg2/Server/Admin.py b/src/lib/Bcfg2/Server/Admin.py
index 98ce9e524..30c04411a 100644
--- a/src/lib/Bcfg2/Server/Admin.py
+++ b/src/lib/Bcfg2/Server/Admin.py
@@ -30,14 +30,7 @@ try:
import Bcfg2.Server.models
HAS_DJANGO = True
- if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
- HAS_REPORTS = True
- else:
- try:
- import south # pylint: disable=W0611
- HAS_REPORTS = True
- except ImportError:
- HAS_REPORTS = False
+ HAS_REPORTS = True
except ImportError:
HAS_DJANGO = False
HAS_REPORTS = False
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index 78eed4b3e..59e9254c1 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -87,11 +87,8 @@ def close_db_connection(func):
self.logger.debug("%s: Closing database connection" %
threading.current_thread().getName())
- if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
- for connection in django.db.connections.all():
- connection.close()
- else:
- django.db.close_connection() # pylint: disable=E1101
+ for connection in django.db.connections.all():
+ connection.close()
return rv
return inner
diff --git a/src/lib/Bcfg2/Server/Plugins/Reporting.py b/src/lib/Bcfg2/Server/Plugins/Reporting.py
index e372006c7..fcce10fc8 100644
--- a/src/lib/Bcfg2/Server/Plugins/Reporting.py
+++ b/src/lib/Bcfg2/Server/Plugins/Reporting.py
@@ -11,11 +11,7 @@ from Bcfg2.Server.Plugin import Statistics, PullSource, Threaded, \
try:
import django
- if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
- HAS_REPORTING = True
- else:
- import south # pylint: disable=W0611
- HAS_REPORTING = True
+ HAS_REPORTING = True
except ImportError:
HAS_REPORTING = False