Django

Code

Ticket #3747 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

Changeset [4724] MySQLdb versioncheck not working.

Reported by: derelm Assigned to: adrian
Milestone: Component: Database wrapper
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

# django/db/backends/mysql/base.py
import MySQLdb as Database
#[...]
if Database.version_info < (1,2,1,'final',2):
	    raise ImportError, "MySQLdb-1.2.1p2 or newer is required; you have %s" % MySQLdb.__version__

Debian Sarge comes with MySQLdb 1.2.1.g2 but the check effectively doesn't kick in.

>>> (1,2,1,'gamma',2) < (1,2,1,'final',2)
False

Also MySQLdb has been imported as Database so the Error raised needs to be

raise ImportError, "MySQLdb-1.2.1p2 or newer is required; you have %s" % Database.__version__

Attachments

Change History

03/18/07 05:23:10 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • summary changed from Changeset [4724] MySQLdb versioncheck not working to Changeset [4724] MySQLdb versioncheck not working..
  • needs_tests changed.
  • needs_docs changed.

Design Decision needed re: version support (we should prob. support a well-established os like sarge, but what are the differences between MySQLdb gamma and final)?

The import error is ready to be checked in.

03/18/07 05:29:31 changed by Simon G. <dev@simon.net.nz>

I've looked around sourceforge for MySQLdb, but can't see any obvious way of finding the differences between 1.2.1 gamma and 1.2.1 final. I doubt, however, that there's any massive changes between a gamma release and a final release.

03/18/07 12:05:35 changed by derelm

With gamma i could not specify DATABASE_OPTIONS = dict(charset="utf8") - that would raise an error. (suggested to fix my problems in #2635). So there seem to be enough differences to cause problems with Django.

03/18/07 14:08:06 changed by mtredinnick

The problem that original forced us to recommend the upgrade to 1.2.1p2 or later (#3279) was only fixed in that precise version. So no earlier versions are recommended for production (and hence any) use with Django. I'm about to check in a version check that knows the difference between "gamma" and "final, 1" and "final, 2".

03/18/07 14:16:47 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [4751]) Fixed #3747 -- Added a stricter MySQLdb version check so that (1, 2, 1, 'final', 2) passes and (1, 2, 1, 'gamma') does not. Also fixed a problem in the error reporting when the check fails.

03/18/07 14:34:24 changed by anonymous

FWIW, this change broke my sites that are hosted on Dreamhost, as they have MySQL 1.2.1g3. Not suggesting it should be undone, just noting it, as I suspect there will be a lot of people wondering what happened.

03/18/07 14:34:49 changed by jeff@jeffcroft.com

Sorry, I didn't mean to post that as anonymous. That was from me, Jeff Croft.

03/18/07 15:43:47 changed by mtredinnick

Jeff: that's the problem (not Dreamhost in particular, but the breakage in general) and why we had a bit of a discussion about this on django-dev. We're going to somewhat damned whichever way we go, unfortunately. :-(

03/18/07 15:46:43 changed by anonymous

Fair enough. Sorry I missed the discussion on django-dev. No big problem for me, just had to rollback that one file on Dreamhost. :)


Add/Change #3747 (Changeset [4724] MySQLdb versioncheck not working.)




Change Properties
Action