Wednesday, April 30, 2014

Version number comparison and beta

Hi all
I'm trying to update some existing code so that it will be compatible with 1.7, in particular the use of settings.AUTH_USER_MODEL instead of get_user_model().
Given the differences I'm going to have to check the version numbers and then have two alternatives eg:

if StrictVersion(get_version()) >= StrictVersion('1.7'):
new code
else:
old code

However the current version number for 1.7 is 1.7b3, which is treated as being less than 1.7 according to StrictVersion.
In order to get it to work the way I want right now I'm going to have to compare with a version number such as 1.7a1,
but this is going to look pretty ugly going forward.

What is the best practice for doing version number comparisons taking into account the existence of beta version numbers?

Thanks
Kevin

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c74612d3-87c7-4f4e-a709-416038fe1860%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment