Update Django version check to support new versioning standard

Review Request #640 — Created Nov. 17, 2008 and submitted

Information

Review Board SVN (deprecated)

Reviewers

Django have now standardised on the format of the django.VERSION tuple (a change that they just missed for 1.0):
http://groups.google.com/group/django-developers/browse_thread/thread/499e891837fd2edc?pli=1

As of 1.0.1, VERSION will always be a 5-tuple of the form (major, minor, micro, release-level, serial).

So 1.0.1 is (1, 0, 1, 'final', 0), and SVN trunk is (1, 1, 0, 'alpha', 0).

This patch fixes the version checking to allow for Django 1.0.1 and above, while still explicitly checking for 1.0 final using its old format.
Was tested by manually overriding django.VERSION just before the version check was performed.

This gave the expected results, i.e. fail for 1.0 beta, and pass for 1.0 final, 1.0.1 final, 1.1 alpha.
OR
  1. Comments below addressed in r2.
  2. /trunk/reviewboard/manage.py (Diff revision 1)
     
     
    I'm new to Python, but I think this line for the explicit 1.0 check may be shorter/nicer(?) as:
    
    if not (django.VERSION == (1, 0, "final") or
  3. /trunk/reviewboard/manage.py (Diff revision 1)
     
     
    Er, and that should be django.VERSION[1].  Doh.
  4. 
      
chipx86
  1. We'll probably want something more explicit for future versions later on. It'd be nice to have a sort of check_version function that hides the actual representation of VERSION. But this looks good for now. Thanks!
    
    Committed in r1591.
  2.