summaryrefslogtreecommitdiffstats
path: root/askbot/deployment
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-03-28 23:03:16 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-03-28 23:03:16 -0400
commit96a9863db21fc84af38ee28684807849ade25b97 (patch)
tree09d752e19aab3f4deb31d77ec68c2f12b48ace57 /askbot/deployment
parent8ae8fcdc858af16e8f2d5ab87ae1a833cde52356 (diff)
downloadaskbot-96a9863db21fc84af38ee28684807849ade25b97.tar.gz
askbot-96a9863db21fc84af38ee28684807849ade25b97.tar.bz2
askbot-96a9863db21fc84af38ee28684807849ade25b97.zip
expanded range of supported versions of django and added patches for csrf_token
Diffstat (limited to 'askbot/deployment')
-rw-r--r--askbot/deployment/assertions.py26
-rw-r--r--askbot/deployment/package_utils.py28
2 files changed, 54 insertions, 0 deletions
diff --git a/askbot/deployment/assertions.py b/askbot/deployment/assertions.py
new file mode 100644
index 00000000..0db62b84
--- /dev/null
+++ b/askbot/deployment/assertions.py
@@ -0,0 +1,26 @@
+"""assertions regarding deployment of askbot
+todo: move here stuff from startup_procedures.py
+
+the reason - some assertions need to be run in askbot/__init__
+as opposed to startup_procedures.py - which are executed in the
+beginning of the models module
+"""
+from askbot.deployment import package_utils
+from askbot.exceptions import DeploymentError
+
+def assert_package_compatibility():
+ """raises an exception if any known incompatibilities
+ are found
+ """
+ (django_major, django_minor, django_micro) = package_utils.get_django_version()
+ if django_major < 1:
+ raise DeploymentError('Django version < 1.0 is not supported by askbot')
+
+ coffin_version = package_utils.get_coffin_version()
+ if coffin_version == (0, 3, 0) and django_major == 1 and django_minor > 1:
+ raise DeploymentError(
+ 'Coffin package version 0.3 is not compatible '
+ 'with the current version of Django, please upgrade '
+ 'coffin to at least 0.3.3'
+ )
+
diff --git a/askbot/deployment/package_utils.py b/askbot/deployment/package_utils.py
new file mode 100644
index 00000000..c2a9b65c
--- /dev/null
+++ b/askbot/deployment/package_utils.py
@@ -0,0 +1,28 @@
+"""utilities that determine versions of packages
+that are part of askbot
+
+versions of all packages are normalized to three-tuples
+of integers (missing zeroes added)
+"""
+import coffin
+import django
+
+def get_coffin_version():
+ """Returns version of Coffin package
+ as a three integer value tuple
+ """
+ version = coffin.__version__
+ if len(version) == 2:
+ micro_version = 0
+ elif len(version) == 3:
+ micro_version = version[2]
+ else:
+ raise ValueError('unsupported version of coffin %s' % '.'.join(version))
+ major_version = version[0]
+ minor_version = version[1]
+ return (major_version, minor_version, micro_version)
+
+def get_django_version():
+ """returns three-tuple for the version
+ of django"""
+ return django.VERSION[:3]