bioweb  0.09.92
C++/Python(django)/JavaScript(angularJS) framework
models.py
Go to the documentation of this file.
1 ## @file version/models.py
2 # @brief server version model
3 
4 """
5 version state module. Return database version, database connecting strings and application build version
6 """
7 
8 from django.db import connection
9 
10 import version_gen
11 
12 def getWebSrvPrefix():
13  return str(version_gen.web_srv_prefix)
14 
15 def getVersionString():
16  """version string, for displaying in client"""
17  return str(version_gen.major) + "." + str(version_gen.minor) + "." + str(version_gen.compilation)
18 
19 def getDBName():
20  """database name"""
21  return version_gen.DB_NAME
22 
23 def getDBUser():
24  """database user"""
25  return version_gen.DB_USER
26 
27 def getDBPassword():
28  """database password"""
29  return version_gen.DB_PASSWORD
30 
31 def _versionFromRow(row):
32  """helping function - parse row to return the correct version"""
33  ver = 'unknown'
34  try:
35  ver = str(row[0].split(',')[0])
36  except:
37  pass
38  return ver
39 
40 def getDBVersionString():
41  """database version"""
42  cursor = connection.cursor()
43  cursor.execute("select version();")
44  row = cursor.fetchone()
45  return _versionFromRow(row)
46 
47 
48