Commit 189a8189 authored by De Boissieu Florian's avatar De Boissieu Florian

fix bug in self.children

--HG--
branch : settersOptions
parent 36061f28
......@@ -3974,6 +3974,12 @@ def generateBuildFn(wrt, prefix, element, delayed):
"MixedContainer.CategoryText,\n")
wrt(" MixedContainer.TypeNone, '', node.text)\n")
wrt(" self.content_.append(obj_)\n")
for child in element.getChildren():
if child.getMaxOccurs() > 1:
origName = child.getName()
name = cleanupName(child.getName())
mappedName = mapName(name)
wrt(' self.%s = []\n' % (mappedName,))
wrt(' for child in node:\n')
wrt(" nodeName_ = Tag_pattern_.match(child.tag).groups()[-1]\n")
wrt(" self.buildChildren(child, node, nodeName_)\n")
......@@ -4209,7 +4215,8 @@ def generateCtor(wrt, prefix, element):
name = cleanupName(child.getCleanName())
childrenNameList.append(name)
wrt(" self.children = %s\n" % ("['" + "', '".join(childrenNameList) + "']"))
wrt(" self.children = %s\n" % ("[" + ", ".join(
map(lambda x: "'"+x+"'", childrenNameList)) + "]"))
wrt(" self.parent = None\n")
parentName, parent = getParentName(element)
if parentName:
......@@ -4775,26 +4782,26 @@ def generateGettersAndSetters(wrt, prefix, element):
wrt(' self.%s = value\n' % (varname))
if PostSetter is not None:
wrt(' if value is not None:\n')
wrt(' %s\n' % (PostSetter))
# if PostSetter is not None:
# wrt(' if value is not None:\n')
# wrt(' %s\n' % (PostSetter))
if child.getMaxOccurs() > 1:
wrt(' def add%s(self, value):\n' % (capName))
wrt(' value.parent = self\n')
wrt(' self.%s.append(value)\n' % (varname))
if PostSetter is not None:
wrt(' %s\n' % (PostSetter))
# if PostSetter is not None:
# wrt(' %s\n' % (PostSetter))
suffix = make_gs_name('at')
wrt(' def insert%s%s(self, index, value):\n' % (capName, suffix))
wrt(' self.%s.insert(index, value)\n' % (name))
wrt(' value.parent = self\n')
if PostSetter is not None:
wrt(' %s\n' % (PostSetter))
# if PostSetter is not None:
# wrt(' %s\n' % (PostSetter))
wrt(' def replace%s%s(self, index, value):\n' % (capName, suffix))
wrt(' value.parent = self\n')
wrt(' self.%s[index] = value\n' % (name))
if PostSetter is not None:
wrt('%s\n' % (indent(PostSetter,2)))
# if PostSetter is not None:
# wrt('%s\n' % (indent(PostSetter,2)))
if GenerateProperties:
# wrt(' %sProp = property(get%s, set%s)\n' %
# (unmappedName, capName, capName))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment