blob: f9d3eede2e321ae8d186974b6a23cdac503aa706 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
"""
:synopsis: the Django Q&A forum application
Functions in the askbot module perform various
basic actions on behalf of the forum application
"""
import os
import smtplib
import sys
import logging
VERSION = (0, 7, 6)
#necessary for interoperability of django and coffin
try:
from askbot import patches
from askbot.deployment.assertions import assert_package_compatibility
assert_package_compatibility()
patches.patch_django()
patches.patch_coffin()#must go after django
except ImportError:
pass
def get_install_directory():
"""returns path to directory
where code of the askbot django application
is installed
"""
return os.path.dirname(__file__)
def get_version():
"""returns version of the askbot app
this version is meaningful for pypi only
"""
return '.'.join([str(subversion) for subversion in VERSION])
def get_database_engine_name():
"""returns name of the database engine,
independently of the version of django
- for django >=1.2 looks into ``settings.DATABASES['default']``,
(i.e. assumes that askbot uses database named 'default')
, and for django 1.1 and below returns settings.DATABASE_ENGINE
"""
import django
from django.conf import settings as django_settings
major_version = django.VERSION[0]
minor_version = django.VERSION[1]
if major_version == 1:
if minor_version > 1:
return django_settings.DATABASES['default']['ENGINE']
else:
return django_settings.DATABASE_ENGINE
|