Commits

Gustavo Picon  committed eabae12

Removed obsolete version checks

  • Participants
  • Parent commits 18448a6

Comments (0)

Files changed (3)

File treebeard/models.py

 
 import operator
 
-from django import VERSION as DJANGO_VERSION
 from django.db.models import Q
 from django.db import models, transaction
 from django.conf import settings
 
         (this is a workaround for a bug in django)
         """
-        if DJANGO_VERSION >= (1, 1):
-            while cls._meta.proxy:
-                cls = cls._meta.proxy_for_model
+        while cls._meta.proxy:
+            cls = cls._meta.proxy_for_model
         return cls
 
     @classmethod
         Returns the supported database engine used by a treebeard model.
 
         This will return the default database engine depending on the version
-        of Django. If you use something different, like a non-default database
-        in Django 1.2+, you need to override this method and return the correct
-        engine.
+        of Django. If you use something different, like a non-default database,
+        you need to override this method and return the correct engine.
 
         :returns: postgresql, postgresql_psycopg2, mysql or sqlite3
         """
         engine = None
-        if DJANGO_VERSION >= (1, 2):
-            try:
-                engine = settings.DATABASES['default']['ENGINE']
-            except AttributeError, KeyError:
-                engine = None
-            # the old style settings still work in Django 1.2+ if there is no
-            # DATABASES setting
+        try:
+            engine = settings.DATABASES['default']['ENGINE']
+        except (AttributeError, KeyError):
+            engine = None
+        # the old style settings still work in Django 1.2+ if there is no
+        # DATABASES setting
         if engine is None:
             engine = settings.DATABASE_ENGINE
         return engine.split('.')[-1]

File treebeard/tests/models.py

 from django.db import models, transaction
 from django.contrib.auth.models import User
-from django import VERSION as DJANGO_VERSION
 from django.conf import settings
 
 from treebeard.mp_tree import MP_Node
 MP_TestNodeShortPath._meta.get_field('path').max_length = 4
 
 
-if DJANGO_VERSION >= (1, 1):  # pragma: no cover
+class MP_TestNode_Proxy(MP_TestNode):
+    class Meta:
+        proxy = True
 
-    class MP_TestNode_Proxy(MP_TestNode):
-        class Meta:
-            proxy = True
 
+class NS_TestNode_Proxy(NS_TestNode):
+    class Meta:
+        proxy = True
 
-    class NS_TestNode_Proxy(NS_TestNode):
-        class Meta:
-            proxy = True
 
-
-    class AL_TestNode_Proxy(AL_TestNode):
-        class Meta:
-            proxy = True
+class AL_TestNode_Proxy(AL_TestNode):
+    class Meta:
+        proxy = True
 
 
 class MP_TestSortedNodeShortPath(MP_Node):

File treebeard/tests/test_treebeard.py

 from django.contrib.auth.models import User
 from django.db.models import Q
 from django.conf import settings
-from django import VERSION as DJANGO_VERSION
 from django.utils.functional import wraps
 
 from treebeard import numconv
 
 
 def _load_test_methods(cls, proxy=True):
-    if proxy and DJANGO_VERSION >= (1, 1):
+    if proxy:
         proxyopts = (False, True)
     else:
         proxyopts = (False,)
                           (u'41', 2, 0)]
 
     def set_MP(self, proxy=False):
-        if proxy and DJANGO_VERSION >= (1, 1):
+        if proxy:
             self.model = models.MP_TestNode_Proxy
         else:
             self.model = models.MP_TestNode
         self.dep_model = models.MP_TestNodeSomeDep
 
     def set_NS(self, proxy=False):
-        if proxy and DJANGO_VERSION >= (1, 1):
+        if proxy:
             self.model = models.NS_TestNode_Proxy
         else:
             self.model = models.NS_TestNode
         self.dep_model = models.NS_TestNodeSomeDep
 
     def set_AL(self, proxy=False):
-        if proxy and DJANGO_VERSION >= (1, 1):
+        if proxy:
             self.model = models.AL_TestNode_Proxy
         else:
             self.model = models.AL_TestNode
         self.dep_model = models.AL_TestNodeSomeDep
 
     def got(self):
-        nsmodels = [models.NS_TestNode]
-        if DJANGO_VERSION >= (1, 1):
-            nsmodels.append(models.NS_TestNode_Proxy)
-        if self.model in nsmodels:
+        if self.model in [models.NS_TestNode, models.NS_TestNode_Proxy]:
             # this slows down nested sets tests quite a bit, but it has the
             # advantage that we'll check the node edges are correct
             d = {}