Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed duplicate caching of mysql_version.

The manual caching in self.server_version and the cached_property
decorator are redundant.
  • Loading branch information...
commit 7b8529d206731bab01855a60f4a6f84e4221f2e1 1 parent 282b2f4
@aaugustin aaugustin authored
Showing with 5 additions and 8 deletions.
  1. +5 −8 django/db/backends/mysql/base.py
View
13 django/db/backends/mysql/base.py
@@ -394,7 +394,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)
- self.server_version = None
self.features = DatabaseFeatures(self)
self.ops = DatabaseOperations(self)
self.client = DatabaseClient(self)
@@ -454,13 +453,11 @@ def _rollback(self):
@cached_property
def mysql_version(self):
- if not self.server_version:
- server_info = self.connection.get_server_info()
- m = server_version_re.match(server_info)
- if not m:
- raise Exception('Unable to determine MySQL version from version string %r' % server_info)
- self.server_version = tuple([int(x) for x in m.groups()])
- return self.server_version
+ server_info = self.connection.get_server_info()
+ match = server_version_re.match(server_info)
+ if not match:
+ raise Exception('Unable to determine MySQL version from version string %r' % server_info)
+ return tuple([int(x) for x in match.groups()])
def disable_constraint_checking(self):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.