core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there

This commit is contained in:
Goffi 2014-03-21 16:08:11 +01:00
commit e689f6bb34

View file

@ -39,7 +39,8 @@ import os.path
from sat.core.default_config import CONST
from sat.core import xmpp
from sat.core import exceptions
from sat.memory.memory import Memory, NO_SECURITY_LIMIT
from sat.core.constants import Const as C
from sat.memory.memory import Memory
from sat.tools.xml_tools import tupleList2dataForm
from sat.tools.misc import TriggerManager
from glob import glob
@ -897,7 +898,7 @@ class SAT(service.Service):
#Menus management
def importMenu(self, path, callback, security_limit=NO_SECURITY_LIMIT, help_string="", type_="NORMAL"):
def importMenu(self, path, callback, security_limit=C.NO_SECURITY_LIMIT, help_string="", type_="NORMAL"):
"""register a new menu for frontends
@param path: path to go to the menu (category/subcategory/.../item), must be an iterable (e.g.: ("File", "Open"))
/!\ use D_() instead of _() for translations (e.g. (D_("File"), D_("Open")))
@ -942,7 +943,7 @@ class SAT(service.Service):
return callback_id
def getMenus(self, language='', security_limit=NO_SECURITY_LIMIT):
def getMenus(self, language='', security_limit=C.NO_SECURITY_LIMIT):
"""Return all menus registered
@param language: language used for translation, or empty string for default
@param security_limit: %(doc_security_limit)s
@ -958,7 +959,7 @@ class SAT(service.Service):
type_ = menu_data['type']
path = menu_data['path']
menu_security_limit = menu_data['security_limit']
if security_limit!=NO_SECURITY_LIMIT and (menu_security_limit==NO_SECURITY_LIMIT or menu_security_limit>security_limit):
if security_limit!=C.NO_SECURITY_LIMIT and (menu_security_limit==C.NO_SECURITY_LIMIT or menu_security_limit>security_limit):
continue
languageSwitch(language)
path_i18n = [_(elt) for elt in path]