comparison src/core/constants.py @ 967:242bd4fc654c

core, frontends (constants): frontends Const inheritates from core Const
author souliane <souliane@mailoo.org>
date Tue, 01 Apr 2014 16:27:59 +0200
parents e1842ebcb2f3
children 8ca5c990ed92
comparison
equal deleted inserted replaced
966:9cae72da1b95 967:242bd4fc654c
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 import os.path 20 import os.path
21 from xdg import BaseDirectory 21 try:
22 from xdg import BaseDirectory
23 except ImportError:
24 # Catch JS runtime error while using Libervia
25 BaseDirectory = None
22 26
23 27
24 class Const(object): 28 class Const(object):
25 29
26 ## Application ## 30 ## Application ##
27 APP_NAME = u'Salut à Toi' 31 APP_NAME = u'Salut à Toi'
28 APP_NAME_SHORT = u'SàT' 32 APP_NAME_SHORT = u'SàT'
29 APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME) 33 APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME)
30 APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions 34 APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions
31 APP_URL = 'http://www.salut-a-toi.org' 35 APP_URL = 'http://salut-a-toi.org'
32
33 36
34 ## Parameters ## 37 ## Parameters ##
35 NO_SECURITY_LIMIT = -1 38 NO_SECURITY_LIMIT = -1
36 INDIVIDUAL = "individual" 39 INDIVIDUAL = "individual"
37 GENERAL = "general" 40 GENERAL = "general"
42 PROF_KEY_DEFAULT = '@DEFAULT@' 45 PROF_KEY_DEFAULT = '@DEFAULT@'
43 ENTITY_ALL = '@ALL@' 46 ENTITY_ALL = '@ALL@'
44 ENTITY_LAST_RESOURCE = 'LAST_RESOURCE' 47 ENTITY_LAST_RESOURCE = 'LAST_RESOURCE'
45 ENTITY_CAP_HASH = 'CAP_HASH' 48 ENTITY_CAP_HASH = 'CAP_HASH'
46 49
50 if BaseDirectory: # skipped when imported from Libervia browser_side
47 51
48 ## Configuration ## 52 ## Configuration ##
49 DEFAULT_CONFIG = { 53 DEFAULT_CONFIG = {
50 'media_dir': '/usr/share/sat/media', 54 'media_dir': '/usr/share/sat/media',
51 'pid_dir': '/tmp', 55 'pid_dir': '/tmp',
52 'log_dir': BaseDirectory.save_data_path('sat'), 56 'log_dir': BaseDirectory.save_data_path('sat'),
53 } 57 }
54 58
55 # XXX: tmp update code, will be removed in the future 59 # XXX: tmp update code, will be removed in the future
56 # When you remove this, please add that in DEFAULT_CONFIG: 60 # When you remove this, please add that in DEFAULT_CONFIG:
57 # 'local_dir': BaseDirectory.save_data_path('sat'), 61 # 'local_dir': BaseDirectory.save_data_path('sat'),
58 # and also remove sat.memory.memory.Memory.__fixLocalDir 62 # and also remove sat.memory.memory.Memory.__fixLocalDir
59 DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat') 63 DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat')
60 64
61 # List of the configuration filenames sorted by ascending priority 65 # List of the configuration filenames sorted by ascending priority
62 CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \ 66 CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \
63 ['/etc/', '~/', '~/.', '', '.'] + \ 67 ['/etc/', '~/', '~/.', '', '.'] + \
64 ['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))] 68 ['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))]
65 ] 69 ]
66
67 70
68 ## Plugins ## 71 ## Plugins ##
69 # names of widely used plugins 72 # names of widely used plugins
70 TEXT_CMDS = 'TEXT-COMMANDS' 73 TEXT_CMDS = 'TEXT-COMMANDS'
71 74