def ParseParameters(self, strParameters):
"""Parses Parameters of Group from a string or list of parameters"""
if dmGlobals.TraceFunctionMessages: print 'Method: dmGroup:ParseParameters(objParameters)'
if isinstance(strParameters, str) or isinstance(strParameters, list):
arrParameters = list()
if isinstance(strParameters, str):
arrParameters = strParameters.splitlines() #split string into lines
elif isinstance(strParameters, list):
arrParameters = strParameters
nReturn = 0
#Parse Group Info from line
if arrParameters[nReturn].startswith(GROUPHEADER):
GroupInfo = self.ParseNodeInfo(arrParameters[nReturn])
self.Name = GroupInfo['GROUP'].strip()
if GroupInfo.haskey('COMMENT'):
self.Comment = GroupInfo['COMMENT'].strip()
if GroupInfo.haskey('FILTERSANDDEFAULTS'):
self.FiltersAndDefaults = dmRuleset(self,GroupInfo['FILTERSANDDEFAULTS'].strip())
#increment nReturn
nReturn = nReturn + 1
while nReturn < len(arrParameters) and not arrParameters[nReturn].startswith(GROUPENDER):
if arrParameters[nReturn].startswith(GROUPHEADER):
nReturn = self.ParseGroup(arrParameters, nReturn, self)
elif arrParameters[nReturn].startswith(RULESETHEADER) or not arrParameters[nReturn].startswith('#'):
nReturn = ParseRuleset(arrParameters, nReturn, self)
elif isinstance(strParameters, XElement):
self.FromXML(strParameters)
pass
评论列表
文章目录