From 38d80f8894d1b9978c21f8d214872f4c559a51dd Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Tue, 26 Sep 2006 16:11:13 +0000 Subject: [PATCH] Fixed #2827 -- Reverted [3855] git-svn-id: http://code.djangoproject.com/svn/django/trunk@3867 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 1 - django/core/management.py | 9 +-------- django/db/backends/mysql/base.py | 11 ----------- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/AUTHORS b/AUTHORS index 5ff4bc4da02..3f256aad096 100644 --- a/AUTHORS +++ b/AUTHORS @@ -119,7 +119,6 @@ answer newbie questions, and generally made Django that much better: Eric Moritz Robin Munn Nebojša Dorđević - Fraser Nevett Sam Newman Neal Norwitz oggie rob diff --git a/django/core/management.py b/django/core/management.py index 4fa40b58074..bcfcd60617e 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -820,8 +820,7 @@ def get_validation_errors(outfile, app=None): validates all models of all installed apps. Writes errors, if any, to outfile. Returns number of errors. """ - from django.conf import settings - from django.db import models, connection + from django.db import models from django.db.models.loading import get_app_errors from django.db.models.fields.related import RelatedObject @@ -863,12 +862,6 @@ def get_validation_errors(outfile, app=None): if f.db_index not in (None, True, False): e.add(opts, '"%s": "db_index" should be either None, True or False.' % f.name) - # Check that maxlength <= 255 if using older MySQL versions. - if settings.DATABASE_ENGINE == 'mysql': - db_version = connection.get_server_version() - if db_version < (5, 0, 3) and isinstance(f, (models.CharField, models.CommaSeparatedIntegerField, models.SlugField)) and f.maxlength > 255: - e.add(opts, '"%s": %s cannot have a "maxlength" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %s).' % (f.name, f.__class__.__name__, '.'.join(str(n) for n in db_version[:3]))) - # Check to see if the related field will clash with any # existing fields, m2m fields, m2m related objects or related objects if f.rel: diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py index e266ad91013..140c6da6ff9 100644 --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -13,7 +13,6 @@ except ImportError, e: from MySQLdb.converters import conversions from MySQLdb.constants import FIELD_TYPE import types -import re DatabaseError = Database.DatabaseError @@ -25,8 +24,6 @@ django_conversions.update({ FIELD_TYPE.TIME: util.typecast_time, }) -server_version_re = re.compile('[.-]') - # This is an extra debug layer over MySQL queries, to display warnings. # It's only used when DEBUG=True. class MysqlDebugWrapper: @@ -114,14 +111,6 @@ class DatabaseWrapper(local): self.connection.close() self.connection = None - def get_server_version(self): - if not self.server_version: - if not self._valid_connection(): - self.cursor() - version = server_version_re.split(self.connection.get_server_info()) - self.server_version = tuple([int(x) for x in version[:3]]) + tuple(version[3:]) - return self.server_version - supports_constraints = True def quote_name(name):