# HG changeset patch # User souliane # Date 1396362479 -7200 # Node ID 242bd4fc654c72abe03b6f5d8cd9c7f27b04ecb9 # Parent 9cae72da1b9524abc5203d6e9b614113e867863c core, frontends (constants): frontends Const inheritates from core Const diff -r 9cae72da1b95 -r 242bd4fc654c frontends/src/constants.py --- a/frontends/src/constants.py Tue Apr 01 21:16:39 2014 +0200 +++ b/frontends/src/constants.py Tue Apr 01 16:27:59 2014 +0200 @@ -18,6 +18,7 @@ # along with this program. If not, see . +from sat.core import constants from sat.core.i18n import _, D_ try: @@ -50,7 +51,8 @@ return presence -class Const(object): +class Const(constants.Const): + PRESENCE = getPresence() MENU_NORMAL = "NORMAL" @@ -60,8 +62,6 @@ SYNTAX_CURRENT = "@CURRENT@" SYNTAX_TEXT = "text" - NO_SECURITY_LIMIT = -1 - # XMLUI SAT_FORM_PREFIX = "SAT_FORM_" SAT_PARAM_SEPARATOR = "_XMLUI_PARAM_" # used to have unique elements names diff -r 9cae72da1b95 -r 242bd4fc654c src/core/constants.py --- a/src/core/constants.py Tue Apr 01 21:16:39 2014 +0200 +++ b/src/core/constants.py Tue Apr 01 16:27:59 2014 +0200 @@ -18,7 +18,11 @@ # along with this program. If not, see . import os.path -from xdg import BaseDirectory +try: + from xdg import BaseDirectory +except ImportError: + # Catch JS runtime error while using Libervia + BaseDirectory = None class Const(object): @@ -27,9 +31,8 @@ APP_NAME = u'Salut à Toi' APP_NAME_SHORT = u'SàT' APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME) - APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions - APP_URL = 'http://www.salut-a-toi.org' - + APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions + APP_URL = 'http://salut-a-toi.org' ## Parameters ## NO_SECURITY_LIMIT = -1 @@ -44,26 +47,26 @@ ENTITY_LAST_RESOURCE = 'LAST_RESOURCE' ENTITY_CAP_HASH = 'CAP_HASH' + if BaseDirectory: # skipped when imported from Libervia browser_side - ## Configuration ## - DEFAULT_CONFIG = { - 'media_dir': '/usr/share/sat/media', - 'pid_dir': '/tmp', - 'log_dir': BaseDirectory.save_data_path('sat'), - } + ## Configuration ## + DEFAULT_CONFIG = { + 'media_dir': '/usr/share/sat/media', + 'pid_dir': '/tmp', + 'log_dir': BaseDirectory.save_data_path('sat'), + } - # XXX: tmp update code, will be removed in the future - # When you remove this, please add that in DEFAULT_CONFIG: - # 'local_dir': BaseDirectory.save_data_path('sat'), - # and also remove sat.memory.memory.Memory.__fixLocalDir - DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat') + # XXX: tmp update code, will be removed in the future + # When you remove this, please add that in DEFAULT_CONFIG: + # 'local_dir': BaseDirectory.save_data_path('sat'), + # and also remove sat.memory.memory.Memory.__fixLocalDir + DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat') - # List of the configuration filenames sorted by ascending priority - CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \ - ['/etc/', '~/', '~/.', '', '.'] + \ - ['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))] - ] - + # List of the configuration filenames sorted by ascending priority + CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \ + ['/etc/', '~/', '~/.', '', '.'] + \ + ['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))] + ] ## Plugins ## # names of widely used plugins