From 9e67c48b6df560127d246cc5d54ab90492ea71cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B0=D0=BC=D0=BE=D1=83=D0=BA=D0=B8=D0=BD=20=D0=90?= =?UTF-8?q?=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Tue, 12 Oct 2010 11:12:32 +0400 Subject: [PATCH] Replaced by the attribute variable 'official' to 'hide'. Changed the priority sections of the variable. --- pym/cl_datavars.py | 23 ++++++++++++----------- pym/cl_vars.py | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/pym/cl_datavars.py b/pym/cl_datavars.py index e01063e..65d613e 100644 --- a/pym/cl_datavars.py +++ b/pym/cl_datavars.py @@ -42,8 +42,8 @@ class var: value = "" # режим записи (атрибут mode) mode = "r" - # переменная для внутреннего использования (official) - official = False + # скрытая переменная + hide = False # был ли вызван метод заполнения isCallFill = False # объект в котором создан этот объект @@ -179,14 +179,15 @@ class DataVars(object): """ # Ищем переменную в модуле dataVar = False + dataVarWork = False e = False - for section, moduleVar, fillobj in self._importList: - try: - dataVar = getattr(moduleVar.Data, nameVar) - except AttributeError, e: - pass - if not dataVar is False: - break + for sectionWork, moduleVar, fillobj in self._importList: + if not hasattr(moduleVar.Data, nameVar): + continue + dataVarWork = getattr(moduleVar.Data, nameVar) + section = sectionWork + if dataVar is False: + dataVar = dataVarWork if dataVar == False: err1 = _("Not found variable %s")%nameVar err2 = "" @@ -616,8 +617,8 @@ storage of variables templates")%location) dictVars = dir(dataVar) for nameVar in dictVars: if not "__" in nameVar and not\ - (getattr(dataVar,nameVar).has_key("official") and\ - getattr(dataVar,nameVar)['official']): + (getattr(dataVar,nameVar).has_key("hide") and\ + getattr(dataVar,nameVar)['hide']): if varsNames and not nameVar in varsNames: continue if reFilter and not reFilter.search(nameVar): diff --git a/pym/cl_vars.py b/pym/cl_vars.py index 36e4b30..9abf461 100644 --- a/pym/cl_vars.py +++ b/pym/cl_vars.py @@ -19,7 +19,7 @@ # 'r' you cann't change value from command line # type - depricated # value - value -# official - show or not variable for display values +# hide - show or not variable for display values class Data: # computer hostname @@ -32,7 +32,7 @@ class Data: os_net_ip ={} # network interfaces - os_net_interfaces={'official':True} + os_net_interfaces={'hide':True} # computer domain os_net_domain = {'mode':"w"} @@ -41,19 +41,19 @@ class Data: os_linux_shortname={} # aliases and path to ini files - cl_env_data = {'official':True, + cl_env_data = {'hide':True, 'value':[('default', '/etc/calculate/calculate2.env'), ('local', '/var/calculate/calculate2.env'), ('remote', '/var/calculate/remote/calculate2.env')]} # path aliases to ini files (from cl_env_data) - cl_env_location = {'official':True} + cl_env_location = {'hide':True} # path to ini files (from cl_env_data) cl_env_path = {} # path to information file on server - cl_env_server_path = {'official':True, + cl_env_server_path = {'hide':True, 'value':'/var/calculate/remote/server.env'} # paths to template files @@ -118,13 +118,13 @@ class Data: ur_login = {} # user group name - ur_group = {'official':True} + ur_group = {'hide':True} # user fullname - ur_fullname = {'official':True} + ur_fullname = {'hide':True} # user home directory - ur_home_path = {'official':True} + ur_home_path = {'hide':True} # path to directory relative which perform joining templates to system files # (sandbox) @@ -142,23 +142,23 @@ class Data: cl_pass_state = {} # User Jabber ID - ur_jid = {'official':True} + ur_jid = {'hide':True} # user email - ur_mail = {'official':True} + ur_mail = {'hide':True} # kernel uid get by uuid root device cl_kernel_uid = {} # variable for calculate-client and calculate-desktop packages # ip or domain name of CDS - cl_remote_host = {'mode':'r', 'official':True} + cl_remote_host = {'mode':'r', 'hide':True} # this variable work with template function belong(package_name) # if the variable is defined then will use only template, which # has package_name in belong equal value of this variable or # hasn't belong function # (package_name == value of cl_belong_pkg) - cl_belong_pkg = {'mode':'r', 'official':True} + cl_belong_pkg = {'mode':'r', 'hide':True} # vertical resolution for X server os_x11_height = {'mode':"w"} @@ -188,7 +188,7 @@ class Data: cl_merges = {} # (on or off) autoupdate config from install program - cl_autoupdate_set = {'official':True, 'value': "off"} + cl_autoupdate_set = {'hide':True, 'value': "off"} # The path to the module api, and additional parameters caluclate packages - cl_api = {'mode':'r', 'official':True, 'value':{}} + cl_api = {'mode':'r', 'hide':True, 'value':{}}